You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "David H. DeWolf" <dd...@apache.org> on 2006/09/23 12:11:57 UTC
[s2] Freemarker Shortcuts
I'm finding that I use something similar to this very often:
<@s.textfield name="user.userName"
value="%{user.userName}"
label="%{getText('user.userName')}"/>
Is anyone aware of a shortcut so that I can eliminate the redundancy?
It would be nice if there was something like:
<@s.textfield property="user.userName"/>
that would accomplish a similar thing. Anyone else running into this
inefficiency?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Freemarker Shortcuts
Posted by "David H. DeWolf" <dd...@apache.org>.
Thanks Ted. I'll file an issue and supply a patch later today.
David
Ted Husted wrote:
>> <@s.textfield name="user.userName"
>> label="%{getText('user.userName')}"/>
>
> should work, but, yes, this is an area where the Struts 2 tags are
> still strangely verbose.
>
> Feel free to file a feature request for concise alternative syntax.
>
> To lookup mesages resources in the S2 validation, we use the attribute
> "key". So, I would suggest something like
>
> <@s.textfield key="user.userName"/>
>
> to grab the label from the message resources and the name/value from
> the user object.
>
> <@s.textfield label_key="userName" name="user.userName" />
>
> (Of course, this isn't a FreeMarker issue per se. All the Struts Tags
> renditions work the same way.)
>
> -- HTH, Ted.
> * http://www.husted.com/struts/
>
>
> On 9/23/06, David H. DeWolf <dd...@apache.org> wrote:
>> I'm finding that I use something similar to this very often:
>>
>> <@s.textfield name="user.userName"
>> value="%{user.userName}"
>> label="%{getText('user.userName')}"/>
>>
>> Is anyone aware of a shortcut so that I can eliminate the redundancy?
>> It would be nice if there was something like:
>>
>> <@s.textfield property="user.userName"/>
>>
>> that would accomplish a similar thing. Anyone else running into this
>> inefficiency?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Freemarker Shortcuts
Posted by Ted Husted <hu...@apache.org>.
> <@s.textfield name="user.userName"
> label="%{getText('user.userName')}"/>
should work, but, yes, this is an area where the Struts 2 tags are
still strangely verbose.
Feel free to file a feature request for concise alternative syntax.
To lookup mesages resources in the S2 validation, we use the attribute
"key". So, I would suggest something like
<@s.textfield key="user.userName"/>
to grab the label from the message resources and the name/value from
the user object.
<@s.textfield label_key="userName" name="user.userName" />
(Of course, this isn't a FreeMarker issue per se. All the Struts Tags
renditions work the same way.)
-- HTH, Ted.
* http://www.husted.com/struts/
On 9/23/06, David H. DeWolf <dd...@apache.org> wrote:
> I'm finding that I use something similar to this very often:
>
> <@s.textfield name="user.userName"
> value="%{user.userName}"
> label="%{getText('user.userName')}"/>
>
> Is anyone aware of a shortcut so that I can eliminate the redundancy?
> It would be nice if there was something like:
>
> <@s.textfield property="user.userName"/>
>
> that would accomplish a similar thing. Anyone else running into this
> inefficiency?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Freemarker Shortcuts
Posted by Chris Pratt <th...@gmail.com>.
I've never used FreeMarker, but it appears to be equivalent to this in
Struts <label>${user.userName} <html:text property="user.userName"></label>.
(At least I assume that's what the label attribute is for.)
(*Chris*)
On 9/23/06, David H. DeWolf <dd...@apache.org> wrote:
>
> I'm finding that I use something similar to this very often:
>
> <@s.textfield name="user.userName"
> value="%{user.userName}"
> label="%{getText('user.userName')}"/>
>
> Is anyone aware of a shortcut so that I can eliminate the redundancy?
> It would be nice if there was something like:
>
> <@s.textfield property="user.userName"/>
>
> that would accomplish a similar thing. Anyone else running into this
> inefficiency?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>