You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mthalis <di...@yahoo.com> on 2008/12/02 12:53:23 UTC

Submit Success and false

After entering data to the form, if it success, it will redirect to the same
page. When it comes to that page the entered data are still the same. I want
to clear those data from my form. But if it fails i want to remain my data
as it is. How can i do it?
this is my part of the struts-config.xml page.
<action
      attribute="userDataEnterForm"
      input="admin.create.page"
      name="userDataEnterForm"
      path="/userDataEnter"
      scope="request"
      type="com.gad.struts.action.UserDataEnterAction">
      <forward name="success" path="admin.create.page" />
      <forward name="failure" path="admin.create.page" />
    </action>
-- 
View this message in context: http://www.nabble.com/Submit-Success-and-false-tp20790660p20790660.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Submit Success and false

Posted by Kibo <to...@gmail.com>.
Before return from Action class set dataObject to null.

public MyAction{
   private DataObject myDataObject;

   //something code

public String execute(){
    myDataObject = null;
   return "success";
}


public getMyDataObject(){
    return myDataObject;
}

}




mthalis wrote:
> 
> After entering data to the form, if it success, it will redirect to the
> same page. When it comes to that page the entered data are still the same.
> I want to clear those data from my form. But if it fails i want to remain
> my data as it is. How can i do it?
> this is my part of the struts-config.xml page.
> <action
>       attribute="userDataEnterForm"
>       input="admin.create.page"
>       name="userDataEnterForm"
>       path="/userDataEnter"
>       scope="request"
>       type="com.gad.struts.action.UserDataEnterAction">
>       <forward name="success" path="admin.create.page" />
>       <forward name="failure" path="admin.create.page" />
>     </action>
> 


-----
Tomas Jurman
Czech Republic
-- 
View this message in context: http://www.nabble.com/Submit-Success-and-false-tp20790660p20790810.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Submit Success and false

Posted by Dave Newton <ne...@yahoo.com>.
--- On Tue, 12/2/08, mthalis wrote:
> After entering data to the form, if it success, it will
> redirect to the same page. When it comes to that page
> the entered data are still the same.
> [...]

That's because you're not redirecting, you're forwarding. If you want to redirect you need to set the "redirect" attribute in the forward element to true.

Dave


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