FAQ
Hi,

I am using html file control to upload a file. If file size exceeds a limit,
then I return an error from Action class through ActionMessages object. The
errors are displayed fine.The problem is that the input form has around 10
fields and after I return control to it for file size limit error display,
all the form fields become empty. How do I retain the values in the form
fields, any idea ?

regards,
Pundarik

Search Discussions

  • Alex Rodriguez Lopez at Mar 24, 2010 at 4:13 pm
    Hi,

    don't know if it will be usefull, but some days ago someone in the user
    list suggested using the getters and setters of the properties that map
    to your form to call get() and put() methods of the current session (
    ActionContext.getContext().getSession() ) , so you get "automatic"
    session persistence of form values.

    regards
    Em 24-03-2010 06:15, pundarik rajkhowa escreveu:
    Hi,

    I am using html file control to upload a file. If file size exceeds a limit,
    then I return an error from Action class through ActionMessages object. The
    errors are displayed fine.The problem is that the input form has around 10
    fields and after I return control to it for file size limit error display,
    all the form fields become empty. How do I retain the values in the form
    fields, any idea ?

    regards,
    Pundarik

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Adam pinder at Mar 24, 2010 at 6:00 pm
    as long as you are simply re-displaying the same form associated with the same action it should work like any other page - the input fields are struts2 tags and there are getters for each property in the action it should retrieve the value and re-display them

    i have a similar thing and it works fine.



    ----------------------------------------
    Date: Wed, 24 Mar 2010 11:45:49 +0530
    Subject: Form values getting empty After validation failure
    From: pundarickr@gmail.com
    To: user@struts.apache.org

    Hi,

    I am using html file control to upload a file. If file size exceeds a limit,
    then I return an error from Action class through ActionMessages object. The
    errors are displayed fine.The problem is that the input form has around 1
    fields and after I return control to it for file size limit error display,
    all the form fields become empty. How do I retain the values in the form
    fields, any idea ?

    regards,
    Pundarik
    _________________________________________________________________
    Send us your Hotmail stories and be featured in our newsletter
    http://clk.atdmt.com/UKM/go/195013117/direct/01/
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Pundarik rajkhowa at Mar 25, 2010 at 4:04 am
    Hi Adam,

    You are right. The problem is fixed now. However I am facing a different
    issue now. I also have a couple of html select controls in the page. For
    them , how do I get the select state restored ? As of now , they take the
    default value even after making a different selection.

    regards,
    Pundarik
    On Wed, Mar 24, 2010 at 11:29 PM, adam pinder wrote:



    as long as you are simply re-displaying the same form associated with the
    same action it should work like any other page - the input fields are
    struts2 tags and there are getters for each property in the action it should
    retrieve the value and re-display them

    i have a similar thing and it works fine.



    ----------------------------------------
    Date: Wed, 24 Mar 2010 11:45:49 +0530
    Subject: Form values getting empty After validation failure
    From: pundarickr@gmail.com
    To: user@struts.apache.org

    Hi,

    I am using html file control to upload a file. If file size exceeds a limit,
    then I return an error from Action class through ActionMessages object. The
    errors are displayed fine.The problem is that the input form has around 10
    fields and after I return control to it for file size limit error display,
    all the form fields become empty. How do I retain the values in the form
    fields, any idea ?

    regards,
    Pundarik
    _________________________________________________________________
    Send us your Hotmail stories and be featured in our newsletter
    http://clk.atdmt.com/UKM/go/195013117/direct/01/
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Adam pinder at Mar 25, 2010 at 2:50 pm
    the selects should behave as any other input type, if the select name has an associated get in the action class then it should re-populate the selected value.

    i use a straight <s:select ../> and its fine.

    if that is all present...

    turn on the debugging for the parameters interceptot and check the select name/value pair being sent to the action class and compare that with the select values in the html page and make sure the value sent does actually exist in the select options when re-rendered.


    ----------------------------------------
    Date: Thu, 25 Mar 2010 09:34:16 +0530
    Subject: Re: Form values getting empty After validation failure
    From: pundarickr@gmail.com
    To: user@struts.apache.org

    Hi Adam,

    You are right. The problem is fixed now. However I am facing a different
    issue now. I also have a couple of html select controls in the page. For
    them , how do I get the select state restored ? As of now , they take the
    default value even after making a different selection.

    regards,
    Pundarik
    On Wed, Mar 24, 2010 at 11:29 PM, adam pinder wrote:



    as long as you are simply re-displaying the same form associated with the
    same action it should work like any other page - the input fields are
    struts2 tags and there are getters for each property in the action it should
    retrieve the value and re-display them

    i have a similar thing and it works fine.



    ----------------------------------------
    Date: Wed, 24 Mar 2010 11:45:49 +0530
    Subject: Form values getting empty After validation failure
    From: pundarickr@gmail.com
    To: user@struts.apache.org

    Hi,

    I am using html file control to upload a file. If file size exceeds a limit,
    then I return an error from Action class through ActionMessages object. The
    errors are displayed fine.The problem is that the input form has around 10
    fields and after I return control to it for file size limit error display,
    all the form fields become empty. How do I retain the values in the form
    fields, any idea ?

    regards,
    Pundarik
    _________________________________________________________________
    Send us your Hotmail stories and be featured in our newsletter
    http://clk.atdmt.com/UKM/go/195013117/direct/01/
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
    _________________________________________________________________
    We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
    http://clk.atdmt.com/UKM/go/195013117/direct/01/
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org
  • Greg Lindholm at Mar 25, 2010 at 2:22 pm
    Does this FAQ entry help?

    http://struts.apache.org/2.x/docs/how-do-we-repopulate-controls-when-validation-fails.html

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
    For additional commands, e-mail: user-help@struts.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesstruts
postedMar 24, '10 at 6:16a
activeMar 25, '10 at 2:50p
posts6
users4
websitestruts.apache.org
irc#struts

People

Translate

site design / logo © 2022 Grokbase