• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
reply
    Bookmark Topic Watch Topic
  • New Topic