• 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

Spring MVC: Is it possible to invoke onSubmit method of SimpleFormController through URL hit

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have question related to Spring MVC.
Is it possible to invoke onSubmit method of SimpleFormController through URL hit.
I know when form is submitted and form submission URL mapped to controller, upon form submission onSubmit method will be called.
But I want to call same onSubmit method of controller by passing form parameters in URL as query string and hit enter from address bar.
Please advise is this possible.
 
Ranch Hand
Posts: 499
Spring AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
poli reddy,

I don't think its possible if you are using post method but if you use get method its possible but this case is a security threat to the data you will be providing
 
poli reddy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Udaykumar,

Thanks for responding.

Usual request parameter names and values can be passed using & concatenation. Can you advise me how to pass CommandObject (Spring MVC form input) parameters via URL to Controller onSubmit().
I do not want to change logic of onSubmit to request.getParameter() to achieve my URL hit requirement. I want to continue current logic in my onSubmit() which is using command object when form submitted in jsp.
 
Partheban Udayakumar
Ranch Hand
Posts: 499
Spring AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
poli reddy,

Try this. I am not sure if this is the correct procedure for passing variables but for your needs you can do this



You will be able to pass params in url as

host:port/yourapp/submit/param1/param2



Note: The name of parameters you pass in url should be given within the brackets of @Pathvariable annotations
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic