Struts and Form validation

Discussion in 'Java' started by tlo, Mar 22, 2007.

  1. tlo

    tlo Guest

    Hi,

    I'm having a basic problem using struct.

    All I want to get to is to show a collection in a select box and if the form is
    incorrectly filled out after a submit the same collection is shown and the
    selection that the user made is still selected.

    I have a collection which from an struct action gets added to the request
    object via setAttribute("types",collection). When the action then forwards onto
    the jsp the jsp then uses the collection in a select tag, like this as part of
    a form
    <html:select property="userType">
    <html:eek:ptions collection="types" property="typeid" labelProperty="typename"/>
    </html:select>
    this works fine when the jsp is first called.

    When the form is submitted and the validate is called on the Form object and an
    non empty erroraction is returned the jsp fails, due to the fact that the
    collection isn't any longer in the request object.

    Can anybody guide me in the right direction.

    Thanks
    TLO
     
    tlo, Mar 22, 2007
    #1
    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. Leo Gaggl
    Replies:
    0
    Views:
    1,063
    Leo Gaggl
    Apr 5, 2004
  2. Sumith Mathur
    Replies:
    0
    Views:
    2,235
    Sumith Mathur
    Sep 23, 2004
  3. javadude
    Replies:
    0
    Views:
    747
    javadude
    Feb 16, 2005
  4. D. Mantelos
    Replies:
    9
    Views:
    7,562
    smshashi
    May 3, 2007
  5. bnp
    Replies:
    4
    Views:
    351
Loading...

Share This Page