You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tim Trentham <TT...@hand.com> on 2003/05/30 01:34:55 UTC
Existing framework for display of string:value pairs?
I've got a question that I'm sure had to have come up already at some point,
but I can't seem to find the answer in the documentation or the mailing list
archive. Is there a framework in place, perhaps through the bean tags, that
allow you to convert form values that you've gotten from the database to
user-friendly strings for display in a JSP?
For example, let's say that I have a field called "Priority". In my
database, the field is stored as an integer and let's say there are only
three values: 1,2,3. These three values correspond to human readable
strings. Let's say they are: "Low", "Medium" and "High", respectively and
they are stored somewhere in the web application. My first guess at this
would be to store the human readable strings as a resource in the
application.properties file, for instance, and then through a custom tag
perhaps, convert the 1, 2 or 3 that's stored in the form bean to the
corresponding user-friendly string when it's displayed.
There appears to be something similar to this for the html:options tag where
you can pass a collection of label:value beans to the tag and it'll render
an html combo box, but I don't see anything like what I'm talking about.
Is there an existing way to do what I'm talking about in Struts or am I on
my own?
Thanks in advance,
Tim
Re: Existing framework for display of string:value pairs?
Posted by Vic Cekvenich <vc...@baseBeans.com>.
I use this for OptionsCollection tag to genericaly decode:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/war/com/baseBeans/scaffoldingXPress/coreBeans/OptionsSelBean.java
.V
Tim Trentham wrote:
>I've got a question that I'm sure had to have come up already at some point,
>but I can't seem to find the answer in the documentation or the mailing list
>archive. Is there a framework in place, perhaps through the bean tags, that
>allow you to convert form values that you've gotten from the database to
>user-friendly strings for display in a JSP?
>
>For example, let's say that I have a field called "Priority". In my
>database, the field is stored as an integer and let's say there are only
>three values: 1,2,3. These three values correspond to human readable
>strings. Let's say they are: "Low", "Medium" and "High", respectively and
>they are stored somewhere in the web application. My first guess at this
>would be to store the human readable strings as a resource in the
>application.properties file, for instance, and then through a custom tag
>perhaps, convert the 1, 2 or 3 that's stored in the form bean to the
>corresponding user-friendly string when it's displayed.
>
>There appears to be something similar to this for the html:options tag where
>you can pass a collection of label:value beans to the tag and it'll render
>an html combo box, but I don't see anything like what I'm talking about.
>
>Is there an existing way to do what I'm talking about in Struts or am I on
>my own?
>
>Thanks in advance,
>
>Tim
>
>
>
--
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA
Advanced <a href ="baseBeans.com">Struts Training</a> and project recovery in North East.
Open Source <a href ="baseBeans.com">Content Management</a> basicPortal sofware
Best practice<a href ="baseBeans.com">Struts Support</a> v.1.1 helper ScafflodingXPress
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org