You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hisameer <co...@yahoo.com> on 2008/07/24 00:24:18 UTC

What is the best way to handle cancel, Update, Back Buttons in Struts2

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-tp18621308p18621308.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: What is the best way to handle cancel, Update, Back Buttons in Struts2

Posted by "matt.payne" <ma...@gmail.com>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What is the best way to handle cancel, Update, Back Buttons in Struts2

Posted by Gabriel Belingueres <be...@gmail.com>.
The defaultStack interceptor stack provides you with convenient method
name defaults which will not run validations. When you call an action
executing any of these method names: "input", "back", "cancel" or
"browse", the validations will not execute.

2008/7/23 hisameer <co...@yahoo.com>:
>
> 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-tp18621308p18621308.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
>
>

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


RE: What is the best way to handle cancel, Update, Back Buttons in Struts2

Posted by Jishnu Viswanath <ji...@tavant.com>.
Did you try <s:submit ? 

Regards,

Jishnu Viswanath

Software Engineer

*(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

Tavant Technologies Inc.,

www.tavant.com

PEOPLE :: PASSION :: EXCELLENCE


-----Original Message-----
From: hisameer [mailto:cool_sameer_for_u@yahoo.com] 
Sent: Thursday, July 24, 2008 3:54 AM
To: user@struts.apache.org
Subject: What is the best way to handle cancel, Update, Back Buttons in
Struts2


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-tp18621308p18621308.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

Any comments or statements made in this email are not necessarily those of Tavant Technologies.
The information transmitted is intended only for the person or entity to which it is addressed and may 
contain confidential and/or privileged material. If you have received this in error, please contact the 
sender and delete the material from any computer. All e-mails sent from or to Tavant Technologies 
may be subject to our monitoring procedures.


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