Is there anyway to bind a pair of typeconverter and formatter to a specific
actionbean class? this way, the customer pair would only apply to this
action bean but would not affect other actions/displays
----- Original Message -----
From: "Anthony DePalma" <[email protected]>
To: "Stripes Users List" <[email protected]>
Sent: Monday, November 14, 2011 6:25:15 AM
Subject: Re: [Stripes-users] Two way type conversion possible?
Alternatively you can create a class to act as both a type converter and type
formatter. Just have the class implement Formatter<T>, TypeConverter<T>, and
register the class in the DefaultFormatterFactory/DefaultTypeConverterFactory
to have them use the convert and format the date automatically .
On Mon, Nov 14, 2011 at 2:31 AM, Janne Jalkanen < [email protected] >
wrote:
Date formatting is usually something that's done by the view component in a
typical MVC model. I'm not sure that the Stripes ActionBean is the right place
to solve this problem.
What we usually do is that we take the Date object up and until the view layer,
then format it with JSTL on our JSP pages, e.g.
<f:formatDate value="${user.registrationDate}"/>
If you find repeating yourself a lot, you could just create a special JSP tag
for yourself. Or an EL function, if you're on a fairly recent spec level.
/Janne
On Nov 14, 2011, at 09:23 , [email protected] wrote:
<blockquote>
Hello:
hi
I am trying to create a custom date converter. but the the typeconverter api
only allows one way, string -> date
I need to use the custom class to convert date back to string with special
logic for display.
The two way special conversion would only apply to the specific Date field.
Using @Validate(converter=class) only work one way, string -> date
I was expecting to have the single converter class to handle both
string -> date and date -> string, similar to other frameworks
(I am actually converting from a different framework to stripes
but stumbled on this issue, as the other framework has conversion method
pair like convertToString and ConvertToObject.
What should i do?
Thanks in Advance.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
</blockquote>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users