Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 06/25/04
- Previous message: Christine Zhou: "ClassCastException on HttpServletRequest"
- In reply to: Russ Perry Jr: "[Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Next in thread: Russ Perry Jr: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Reply: Russ Perry Jr: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Jun 2004 06:37:22 -0500
"Russ Perry Jr" <slapdash@rcn.com> wrote in message
news:c630de0a.0406241446.77724ad7@posting.google.com...
> 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?
Store selected ID/value pairs in a Map in the session for display and then
use after confirmation? You'd be better off posting to
comp.lang.java.programmer. This group is not supposed to exist.
- Previous message: Christine Zhou: "ClassCastException on HttpServletRequest"
- In reply to: Russ Perry Jr: "[Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Next in thread: Russ Perry Jr: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Reply: Russ Perry Jr: "Re: [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|