Hi
Option 1 sounds good and is as Kai says useful in other circumstances too :)
/Jepe
_____
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ben
Gunter
Sent: 26. maj 2007 19:03
To: Stripes Development List
Subject: Re: [Stripes-dev] stripes:param should use formatters when possible
I knew there had to be more to this story :)
As it turns out, if you use s:param in the form:
<s:param name="x">${someObject}</s:param>
Then the tag's body content is only available as a String. There's no way to
apply a formatter to it because it gets evaluated ahead of time by the JSP
engine. On the other hand...
<s:param name="x" value="${someObject}" />
Does pass the Object into setValue so a Formatter could be used there. The
problem with that is that the s:param tag is expected to pass the original
Object value to its parent tag, not necessarily just a String. That means
it's up to the parent tag to format it correctly. And the problem with
/that/ is that some formatters require a format pattern and/or format type,
and that bit of information might be different for each parameter.
So we're left with a few choices...
1. Add a new tag <s:format value="" [var=""] [formatType=""]
[formatPattern=""] />. One could then use it like <s:param
name="x"><s:format value="${someObject}" /></s:param>
2. Add some new attributes to s:param, such as format="true",
formatType="whatever" and formatPattern="whatever". format="true" would be
assumed if either formatType or formatPattern were non-null. If formatType
and formatPattern are not applicable for a given parameter, then
format="true" would be required as the default would be false.
3. Do nothing. I don't like this idea :)
I really like option (1). This would be a good idea because it is useful in
many different situations and allows developers to take full advantage of
Stripes' formatting capabilities from within their JSPs. Imagine this, given
a Person class with firstName and lastName properties:
* <s:format formatType="lastNameFirst" value="${person}" /> -- Gunter,
Ben
* <s:format formatType="normal" value="${person}" /> -- Ben Gunter
* <s:format value="${person}" /> -- the primary key of the object,
which is the default format
I'll do this if nobody is opposed to the idea. It solves the s:param problem
nicely and provides lots of other useful capabilities.
-Ben
Jeppe Cramon wrote:
No, I agree :)
/Jeppe
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:stripes-
[EMAIL PROTECTED] On Behalf Of Ben Gunter
Sent: 26. maj 2007 02:38
To: Stripes Development List
Subject: [Stripes-dev] stripes:param should use formatters when possible
Does anybody disagree with this?
http://mc4j.org/jira/browse/STS-374
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development
__________ NOD32 2292 (20070525) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development
__________ NOD32 2292 (20070525) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development