You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by abhiram <ab...@yahoo.com> on 2007/08/22 17:30:13 UTC

redirect to jsp when cancel button is pressed(without executing the corresponding action)

Hi!! i have a small problem..

    in a particular jsp (which is a form), there is a cancel button(<html:cancel/>).

i just want to know how to redirect to another page when the cancel button is pressed (instead of executing the corresponding Action of the form).

for instance.. there is a page called AddAddress.jsp which contains a form to add a new address. it has two buttons submit and cancel. now i dont want the newly entered address to enter the database when i press 'cancel' (which happens when i click 'submit'), and instead i want to redirect to a different jsp.
how to do this?

thanks,
      





      abhiram




       
---------------------------------
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.

value attribute in the tag

Posted by "Zhang, Larry (L.)" <lz...@ford.com>.
On myForm, I have a collection (an array of Analyst objects),
analystList, when I iterate through it, I want to render a check box for
each row, and I specifically want to put the analyst id to value
attribute of the checkbox tag, do you know how to do it? And also how to
get the value of the check box?


<logic:iterate name="myForm" property="analystList" id="oneAnalyst">
	<html:checkbox name="oneAnalyst" property="analystName"
value="???"  indexed="true"></html:checkbox>                
 </logic:iterate>					                
		
Many Thanks.

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


RE: redirect to jsp when cancel button is pressed(without executing the corresponding action)

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Your form buttons do not have to invoke the same action.  Try this
<ul class="formbuttons">
	<li><s:submit name="save" action="maintainChangeAction!save"
value="Save" /></li>
	<li><s:submit name="cancel"  href="otherJsp.jsp"  value="Cancel"
/></li>
</ul>
-----Original Message-----
From: abhiram [mailto:abhi_p24@yahoo.com] 
Sent: Wednesday, August 22, 2007 11:30 AM
To: struts forum
Subject: redirect to jsp when cancel button is pressed(without executing
the corresponding action)

Hi!! i have a small problem..

    in a particular jsp (which is a form), there is a cancel
button(<html:cancel/>).

i just want to know how to redirect to another page when the cancel
button is pressed (instead of executing the corresponding Action of the
form).

for instance.. there is a page called AddAddress.jsp which contains a
form to add a new address. it has two buttons submit and cancel. now i
dont want the newly entered address to enter the database when i press
'cancel' (which happens when i click 'submit'), and instead i want to
redirect to a different jsp.
how to do this?

thanks,
      





      abhiram




       
---------------------------------
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.

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


Re: redirect to jsp when cancel button is pressed(without executing the corresponding action)

Posted by abhiram <ab...@yahoo.com>.
hi!! that was a smart way.. but i could make it work only in static html..and not in a jsp with struts tags. i want to use only struts tags .

it is working if i write it this way..

<html:form action="/AddressAction.do">
   ------
----------
--------
<html:submit/>
</html:form>
<form action="MyAccount.jsp">
   <input type="submit" value="cancel">
</form>

but if i write an <html:form> for the second form too.. it is not working.. as it was unable to identify mapping for the action /MyAccount (.jsp). i didnt understand what to write in my struts-config.

here is wat i wrote for the second form in this case

   <html:form action="MyAccount.jsp"><html:cancel/></html:form>

and in struts-config.xml,

<action path="/MyAccount" forward="/MyAccount.jsp"/>

please help me out.. and please suggest the many other options u mentioned

thanks,
abhiram

--------------------------------------------------------------------------------------------------------------------

sriharsha.chevuru@wachovia.com wrote: One of many options, I can think over the top of my head is, use just that 
button in a different form. Simple but I guess it would work.



abhiram  
08/22/2007 08:30 AM

Please respond to
"Struts Users Mailing List" 


To
struts forum 
cc

Subject
redirect  to jsp when cancel button is pressed(without executing the 
corresponding action)






Hi!! i have a small problem..

    in a particular jsp (which is a form), there is a cancel 
button().

i just want to know how to redirect to another page when the cancel button 
is pressed (instead of executing the corresponding Action of the form).

for instance.. there is a page called AddAddress.jsp which contains a form 
to add a new address. it has two buttons submit and cancel. now i dont 
want the newly entered address to enter the database when i press 'cancel' 
(which happens when i click 'submit'), and instead i want to redirect to a 
different jsp.
how to do this?

thanks,
 





      abhiram




 
---------------------------------
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
ForwardSourceID:NT00009F02 


       
---------------------------------
 Unlimited freedom, unlimited storage. Get it now

Re: redirect to jsp when cancel button is pressed(without executing the corresponding action)

Posted by sr...@wachovia.com.
One of many options, I can think over the top of my head is, use just that 
button in a different form. Simple but I guess it would work.



abhiram <ab...@yahoo.com> 
08/22/2007 08:30 AM

Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>


To
struts forum <us...@struts.apache.org>
cc

Subject
redirect  to jsp when cancel button is pressed(without executing the 
corresponding action)






Hi!! i have a small problem..

    in a particular jsp (which is a form), there is a cancel 
button(<html:cancel/>).

i just want to know how to redirect to another page when the cancel button 
is pressed (instead of executing the corresponding Action of the form).

for instance.. there is a page called AddAddress.jsp which contains a form 
to add a new address. it has two buttons submit and cancel. now i dont 
want the newly entered address to enter the database when i press 'cancel' 
(which happens when i click 'submit'), and instead i want to redirect to a 
different jsp.
how to do this?

thanks,
 





      abhiram




 
---------------------------------
 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
ForwardSourceID:NT00009F02