Just set the value name to cancel/back. e.g.
<input type="submit" class="submit cancel"
name="cancel"
id="cancelButton" value="Cancel"/>
--> in struts.xml
<interceptor name="cancel"
class="com.sutternow.xwork.interceptors.SkipInterceptor">
cancel
cancel
</interceptor>
<interceptor name="back"
class="com.sutternow.xwork.interceptors.SkipInterceptor">
back
back
</interceptor>
Put interceptors like above in your stack.
http://struts2-interceptors.googlecode.com/svn/trunk/src/main/java/com/sutternow/xwork/interceptors/SkipInterceptor.java
Matt
hisameer wrote:
>
> Hello Everyone
>
> I know this might be very easy for you guys but it is being difficult for
> me.:working:
>
> I am developing an updateUser.jsp page and it has three buttons those are:
> Update, Cancel, Back
> Now if I press update it should invoke the updateUser action mapping also
> I need to do the validation first before I do something else. If Cancel is
> pressed the previous values which was already there in the field should be
> displayed and when I press Back button it should not do anything just go
> to my userList page.
>
> So I am not able to understand how should I handle the struts.xml and the
> jsp code. I know I can use built in validator framework and by defining
> the validation.xml file for those fields but whenever I cancel or go Back
> the error message appears in the page so I don't know how should I handle
> this thing.
>
> Please tell me the best way from your experience how should I handle this
> kind of situation.
>
> Thanks for the help in advance!
>
--
View this message in context:
http://www.nabble.com/What-is-the-best-way-to-handle-cancel%2C-Update%2C-Back-Buttons-in-Struts2-tp18621308p18637728.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]