You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "CRANFORD, CHRIS" <Ch...@setechusa.com> on 2005/02/10 13:34:20 UTC
Taglib vs. Action To Populate LOVs.
I have a form which needs to display several dropdown combo boxes, one in
particular is to be populated with values as follows:
Today
Yesterday
This Week
Last Week
This Month
Last Month
Last 3 Months
This Year
Last Year
series of Month/Day/Year values
All
I wanted to ask others opinion on which is the better approach to populating
this combo-box values? I could use a taglib similar to the following:
<ss:TransactionDateSelectBox name="transactionForm" property="date"/>
The above would do a bean lookup for transactionForm with property date and
output the necessary HTML select/option tags needed to show the form's
selection box.
Or my action which forwards to the JSP could populate a collection of
LabelValueBean objects and then the JSP could iterate over the collection
using html:options.
Anyone have any suggestion on which is a better approach long-term?
Thanks
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Taglib vs. Action To Populate LOVs.
Posted by Joe Germuska <Jo...@Germuska.com>.
At 7:34 AM -0500 2/10/05, CRANFORD, CHRIS wrote:
>I have a form which needs to display several dropdown combo boxes, one in
>particular is to be populated with values as follows:
>
> Today
> Yesterday
> This Week
> Last Week
> This Month
> Last Month
> Last 3 Months
> This Year
> Last Year
> series of Month/Day/Year values
> All
>
>I wanted to ask others opinion on which is the better approach to populating
>this combo-box values? I could use a taglib similar to the following:
>
> <ss:TransactionDateSelectBox name="transactionForm" property="date"/>
>
>The above would do a bean lookup for transactionForm with property date and
>output the necessary HTML select/option tags needed to show the form's
>selection box.
>
>Or my action which forwards to the JSP could populate a collection of
>LabelValueBean objects and then the JSP could iterate over the collection
>using html:options.
For a menu like this (which appears as though it might be constant in
the scope of the application), I would suggest making the list of
LVBs in a ServletContextListener or PlugIn and storing them in
application scope; then you may not even need a prep-action.
You can use the Digesting PlugIn and the stock
"lvb-digester-rules.xml" and do this very easily. See
http://svn.apache.org/repos/asf/struts/apps/trunk/shared/src/webapp/WEB-INF/struts-config.xml
for an example of how to configure, and other files near that in the
SVN repository for examples of the XML for the menu options and the
digester rules.
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org