The following comment has been added to this issue:

     Author: Cameron Braid
    Created: Wed, 27 Aug 2003 6:10 AM
       Body:
I have given this a go.. I dunno if I have produced the best soloution, though it 
seems to work with my requirements.

As soon as I work out how to run "ant test" I'll make sure that it works with the 
existing tests, create a specific unit test, and commit it.
---------------------------------------------------------------------
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: Assigned
   Priority: Major

    Project: WebWork
 Components: 
             Views
   Fix Fors:
             2.0

   Assignee: Patrick Lightbody
   Reporter: Cameron Braid

    Created: Tue, 26 Aug 2003 10:03 AM
    Updated: Tue, 26 Aug 2003 1:01 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
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to