[Help] Struts/JSP -- easy way associate an "ID" to a "Value"?
From: Russ Perry Jr (slapdash_at_rcn.com)
Date: 06/25/04
- Previous message: Lou Arnold: "Advice Java or something else"
- Next in thread: Ryan Stewart: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Reply: Ryan Stewart: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Jun 2004 15:46:28 -0700
I'm using "ID" and "Value" in the generic sense here...
Let's say one page I had a <html:select> with a collection like this:
<html:options collection="items" property="key" labelProperty="value"/>
In this case "key" is what I mean by "ID", and "value" is what I mean
by "Value" -- the "Value" is shown to the user, but the "ID" is what
I plan to keep, to be saved to a database (as a reference in a table
to a common table as a part of normalization). Oh, and "items" is
just a vector of a simple object with key, value & extraValue fields,
and extraValue isn't always used.
Now, what I'm running into is that they want a confirmation screen
(let's call that "Page X") -- print out the values the user has input
(on what we'll call "Page 1" and "Page 2" since we're combining two
screens for confirmation (our business model requires this as two
separate steps) and confirm before processing (i.e. saving to the
database and started business flow on it) all the data.
Now, I have easy access to the "ID" on the Page2ActionForm, but I
want to show the "Value" instead. Obviously, I can read through the
original "items" object, compare the "key" values and return the
"value" value (ugh, sorry) when found, but that seems tedious.
Is there an easy/better way to do this? Some way I can easily do
this with JSP tags? It seems <logic:iterate> is going output
everything (as I don't think I can put a <bean:write> of the
Page2ActionForm property "ID" as a value in a <logic:equal> inside
the <logic:iterate> as, from experience, it seems struts doesn't
like nesting tags :-), and I don't see any other logic or bean tag
examples that do what I'm looking for.
On the off chance the above makes sense to anyone, does anyone have
a quick & easy way, or I should I get around to writing my find
routines?
- Previous message: Lou Arnold: "Advice Java or something else"
- Next in thread: Ryan Stewart: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Reply: Ryan Stewart: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|