This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
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
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • 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

 
I didn't say it. I'm just telling you what this tiny ad said.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic