My page has 2 buttons in one form. One is the submit1 button, another one is a submit2 button. I use <html:img> or <html:image> tags for the buttons. I was wondering how I could get my action to determine which button was clicked and have the forward subsequently use the right method in my action.
Originally posted by satish_t: My page has 2 buttons in one form. One is the submit1 button, another one is a submit2 button. I use <html:img> or <html:image> tags for the buttons. I was wondering how I could get my action to determine which button was clicked and have the forward subsequently use the right method in my action.
you can pass some hidden action value which will determine which button was clicked. use onclick event on html:img or html:image tag to set the action value.
Hope this helps
SCJP5
Satish Kumar
Ranch Hand
Joined: Oct 16, 2006
Posts: 84
posted
0
Dear David O'Meara i hope it's fine now.
Satish Kumar
Ranch Hand
Joined: Oct 16, 2006
Posts: 84
posted
0
The problem is that i cannot use javascript. is there anyother way to achieve this?
Shilpa Tendulkar
Ranch Hand
Joined: Jul 29, 2001
Posts: 75
posted
0
Originally posted by satish kumar: The problem is that i cannot use javascript. is there anyother way to achieve this?
you can use property and value attribute of html:image tag to find out which button was clicked.
Satish Kumar
Ranch Hand
Joined: Oct 16, 2006
Posts: 84
posted
0
Originally posted by Shilpa Tendulkar:
you can use property and value attribute of html:image tag to find out which button was clicked.
its not working this way. when i tried its giving null in the action class when i give request.getParameter("submit"). May i know its working for you? if yes could you please send the sample code.
Hi Satish, Using LookUpDispatchAction would solve all your problems and would give you scalaibity also. Please find the following link. http://husted.com/struts/tips/003.html If there is any problem, post your problem. Regards, Roshani
Regards,<br />Roshani
Satish Kumar
Ranch Hand
Joined: Oct 16, 2006
Posts: 84
posted
0
Hi Roshani, I am using LookupDispatchAction only. I need to identify which button is being clicked using the <html:image> tag. i HAVE A SET OF BUTTONS and need to get the value in the bean or any scope.