[JIRA-OS] Commented: (WW-271) Converter framework needs to be able to support plugable to String converters

[email protected]
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
The following comment has been added to this issue:

     Author: Patrick Lightbody
    Created: Sun, 14 Sep 2003 7:09 PM
       Body:
Cameron, 
The XWork conversion framework allows for both conversion _to_ and conversion _from_ strings, so I don't think you need to do much here. Please drop me an email explaining your thoughts on this.
---------------------------------------------------------------------
View the issue:

  http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WW-271


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: WW-271
    Summary: Converter framework needs to be able to support plugable to String converters
       Type: Improvement

     Status: In Progress
   Priority: Major

    Project: WebWork
 Components: 
             Views
   Fix Fors:
             2.0-beta2

   Assignee: Patrick Lightbody
   Reporter: Cameron Braid

    Created: Tue, 26 Aug 2003 10:03 AM
    Updated: Sun, 14 Sep 2003 7:09 PM

Description:
Currently they conversion framework allows for plugable converters that are used when converting http request string values into the action properties.  

This works really well.

However, when converting action properties to strings the vm macros use toString().

I believe that this system needs to be configurable.  Allowing user defined converter classes to be specified for converting to string.

I also propose that a public API be created to allow reuse of the converters within actions and views.

i.e. a custom form that posts to an action.  The action doesn't use the params-interceptor because the number of form fields are determined at runtime.  The action processes the http request itself, calling

CustomClass cc = (CustomClass)ConverterManager.getInstance().convertFromString(requestMap.get("thingy"), CustomClass.class);

AND

in a velocity view.  Put the ConverterManager instance as into the velo context as $converterManager

#foreach $item in $items
  <input type='text' value='${stringUtil.toHtml(converterManager.convertToString($item))}'>
#end


Some reasons for having this feature :

a) most of the custom types in our applications use interfaces, with dynamic proxies.  I wish to not rely on toString()

b) allows customization of default date formatting, numeric formatting, etc.. 

ALSO :

As demonstrated above, there exists a need to a stringUtil class to escape HTML.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.opensymphony.com/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.