[Help] Struts/JSP -- easy way associate an "ID" to a "Value"?

From: Russ Perry Jr (slapdash_at_rcn.com)
Date: 06/25/04

  • Next message: Matthew Crouch: "getting stuff out of an applet?"
    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?


  • Next message: Matthew Crouch: "getting stuff out of an applet?"

    Relevant Pages

    • [Help] Struts/JSP -- easy way associate an "ID" to a "Value"?
      ... to be saved to a database (as a reference in a table ... Now, I have easy access to the "ID" on the Page2ActionForm, but I ... this with JSP tags? ... Page2ActionForm property "ID" as a value in a inside ...
      (comp.lang.java.help)
    • Re: ObjectDataSource and Linq. Please, help! I dont know what else to try. Thank You.
      ... MyDbDataContext database = new MyDbDataContext; ... 'GetTags' that has no parameters. ... in LabDataContext class using the following: ... Dim tags = From t In database.Tags _ ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: HTML doc save dialog
      ... After getting the string from database do not set the string to ... > and end html tags. ... In the document complete event of browser, ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Help needed on custom tag
      ... > I need to develop a Custom tag that retrieves the values from ... > two database tables. ... > here display data from second table here display data from second table ... Although I wouldn't recommend it for production the JSTL tags provide ...
      (comp.lang.java.developer)
    • Amarok, Songbird, and other similar players...
      ... countless of hours trying to fix song tags that seems to be ... it *seems* to me that these players ... these players to incorporate these updates into their database ...
      (Fedora)