Small problem with error handling [Struts]

V

vysh

hi,
I have an updation form.On click of
the update button I am doing some validations in my Action class.In
case of any error it will redirect back to the input page.
Now comes my problem.As I have told you,my form is an updation form.So
it contains field already set with some values,a bean.When the
error ,redirects control back to the input page,the newly enterd data
is not displayed and instead the old bean contents are resetted.How to
persist the newly entered data?

any suggestions?
thanks,
vysh
 
S

Sanjay

vysh said:
hi,
I have an updation form.On click of
the update button I am doing some validations in my Action class.In
case of any error it will redirect back to the input page.
Now comes my problem.As I have told you,my form is an updation form.So
it contains field already set with some values,a bean.When the
error ,redirects control back to the input page,the newly enterd data
is not displayed and instead the old bean contents are resetted.How to
persist the newly entered data?

any suggestions?
thanks,
vysh

Are you using validator framework? If not I would suggest you use that.
Otherwise if you are writing your own code for error checking in action
classes, create a form bean and copy all the user input. Set this bean
in request scope, so that when you forward back to the jsp page, it will
be available there.
 
V

vysh

Are you using validator framework? If not I would suggest you use that.
Otherwise if you are writing your own code for error checking in action
classes, create a form bean and copy all the user input. Set this bean
in request scope, so that when you forward back to the jsp page, it will
be available there.

Thanks a lot for your reply,sanjay.
Let me not think of using the validator framework now.So comes the
second option.
I am validating it in the action class.Let the formbean, which gets
populated be x.
As u told,I will create another bean 'y' with the same contents as
x.But how to copy the contents of x to y.
Do I have to set each setter or is there any way for bulk
setting?.Also l have to clear the bean x as I am using the same
Actionform for another jsp page.

waiting for your reply,
thanks,
vysh.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top