Struts: How do I validate data from an edit form?  
Author Message
s.humnig





PostPosted: 2004-10-19 1:15:00 Top

java-programmer, Struts: How do I validate data from an edit form? 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
 
Big Jim





PostPosted: 2004-10-19 1:49:00 Top

java-programmer >> Struts: How do I validate data from an edit form? Does your bean have session scope?

"Stefan" <email***@***.com> wrote in message
news:email***@***.com...
> 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