Struts: How do I validate data from an edit form?

Discussion in 'Java' started by Stefan, Oct 18, 2004.

  1. Stefan

    Stefan Guest

    Hello!

    In my Struts app - after submit - I want to validate fields that were
    filled with values from a database beforehand. To fill the fields with
    the old values I write the existing data into a bean and use it in my
    JSP as follows:

    <jsp:useBean id="formData" scope="request" class="com.xyz"/>

    <html:text name="formData" property="test"/>

    So far so good.

    When a validation error occurs the user is redirected to the same JSP.

    The problem now is that the fields are empty because the bean defined
    in the JSP doesn't exist anymore. In fact I actually don't want this
    bean to be used. The form-bean which is containing the new data should
    be used.

    How can I acchieve that?

    Regards,
    Stefan
     
    Stefan, Oct 18, 2004
    #1
    1. Advertisements

  2. Stefan

    Big Jim Guest

    Does your bean have session scope?
     
    Big Jim, Oct 18, 2004
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.