• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which controller I have to use for a page having multiple submit buttons

 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to Spring MVC and I am having a page with three buttons for this which controller I have to use. Is this be possible with all the three buttons as submit buttons or I have to use one as submit button and the other two as normal buttons and using onclick should I have to submit this form for these two buttons.

Please guide me.

Thanking you
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either would work but it sounds like you question is can you use multiple submit buttons for a single spring form. The answer is yes (Assuming your using Spring 3).





If you use this method note that if the form is submited via pressing the enter button (rather than clicking the button) some browsers dont send a param. In this case it is important to define a 'default action' which should be the first submit defined on the form.

Alternatively you could use this approach as well and handle both submit buttons with the same request handler:


 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mr. Bill,

Thank you for the reply. Yes my question is the same what you understand. Actually I am in to struts 1.3 and working with that for more than 3 years. Just I got an opportunity to work in Spring. In struts we have Mapping Dispatch Action and LookupDispatch Action. I am trying to know is there any classes like these two in Spring also.


I will try it according to your reply and let you know if there is any problem.

--regards,
raaja g

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic