Small problem with error handling [Struts]

Discussion in 'Java' started by vysh, May 3, 2007.

  1. vysh

    vysh Guest

    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
    vysh, May 3, 2007
    #1
    1. Advertising

  2. vysh

    Sanjay Guest

    vysh wrote:
    > 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.
    Sanjay, May 3, 2007
    #2
    1. Advertising

  3. vysh

    vysh Guest

    On May 3, 5:45 pm, Sanjay <> wrote:
    > vysh wrote:
    > > 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.


    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.
    vysh, May 4, 2007
    #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. Katie Wright
    Replies:
    8
    Views:
    4,230
    Andrea Desole
    Jan 7, 2005
  2. Jason Us
    Replies:
    0
    Views:
    978
    Jason Us
    Oct 4, 2003
  3. jc1771
    Replies:
    0
    Views:
    396
    jc1771
    Dec 28, 2003
  4. Aleksandar Matijaca
    Replies:
    2
    Views:
    8,298
    Aleksandar Matijaca
    Sep 19, 2004
  5. Tim Slattery

    Struts error handling

    Tim Slattery, Mar 16, 2006, in forum: Java
    Replies:
    0
    Views:
    2,906
    Tim Slattery
    Mar 16, 2006
Loading...

Share This Page