Selecting several items in a jsp with struts

Discussion in 'Java' started by Jim Smith, May 27, 2004.

  1. Jim Smith

    Jim Smith Guest

    I have a fairly simple problem which I am having trouble solving using
    struts.

    The problem.

    I have a list of items (a List) which I want to display in a JSP, allow
    the user to select some of them and submit the page to produce a report
    based on the items selected.

    If I was doing this in straight JSP/HTML I would list the items with a
    checkbox whose value is the id of the item. This would make an array of
    ids available to the back end.

    I can't seem to do this with struts. Checkboxes can only have boolean
    values, parallel arrays of hidden fields containing the id and a check
    boxes don't work because the boolean array only contains those fields
    which are checked and which puts it out of synch with the id array.

    The only thing I can think of is using javascript to set hidden field
    values when the check boxes are clicked, but there ought to be a cleaner
    way.

    Any suggestions.
    --
    Jim Smith
    Because of their persistent net abuse, I ignore mail from
    these domains (among others) .yahoo.com .hotmail.com .kr .cn .tw
    For an explanation see <http://www.jimsmith.demon.co.uk/spam>
     
    Jim Smith, May 27, 2004
    #1
    1. Advertising

  2. Jim Smith

    Sudsy Guest

    Jim Smith wrote:
    <snip>
    > The only thing I can think of is using javascript to set hidden field
    > values when the check boxes are clicked, but there ought to be a cleaner
    > way.


    There is: it's called indexed properties. I've written an article
    which you should find helpful:
    <http://www.sudsy.net/technology/struts-advanced.html>
     
    Sudsy, May 27, 2004
    #2
    1. Advertising

  3. Jim Smith

    Ryan Stewart Guest

    "Sudsy" <> wrote in message
    news:...
    > Jim Smith wrote:
    > <snip>
    > > The only thing I can think of is using javascript to set hidden field
    > > values when the check boxes are clicked, but there ought to be a cleaner
    > > way.

    >
    > There is: it's called indexed properties. I've written an article
    > which you should find helpful:
    > <http://www.sudsy.net/technology/struts-advanced.html>
    >

    I didn't read it all in depth, but it looks kinda like you're taking the
    long way around trying to duplicate the functionality of the html:multibox
    tag? If not, ignore me. I just want to make sure you know it's there.
     
    Ryan Stewart, May 28, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthias Nietz
    Replies:
    1
    Views:
    3,457
    VisionSet
    Nov 12, 2003
  2. Helmut Blass
    Replies:
    2
    Views:
    625
    Helmut Blass
    Jan 29, 2004
  3. Replies:
    0
    Views:
    4,406
  4. gjhames

    Replace Several Items

    gjhames, Aug 13, 2008, in forum: Python
    Replies:
    12
    Views:
    510
    M.-A. Lemburg
    Aug 14, 2008
  5. Victor \Zverok\ Shepelev

    RDOC: several related modules in several C files

    Victor \Zverok\ Shepelev, Mar 6, 2007, in forum: Ruby
    Replies:
    3
    Views:
    185
    Max Lapshin
    Mar 16, 2007
Loading...

Share This Page