• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring - passing values by parametrs to Controller

 
sandeep lokhande
Ranch Hand
Posts: 120
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this possible to send some parameters to Controller in spring?
I am trying to send empid from some .jsp and want to process it on Controller.
I have not access to request and response object in my Controller.

my Controller is as,


Can i Do it?
If yes, then please suggest me how to do it.
Thank you in advance.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of-course you can and that is why they are called controller sticking to MVC architecture,
the thing you must POST the values while submitting the page i;e specify method=POST in the form tag and specify the action attribute to which the proper mapping should be done in your spring configuration file & now in the controller your method will have the parameters of HttpServletRequest , HttpServletRespone and ..... as far as your requirement and method signature is correct.

use the request object to get the parameters like


the string should match with the name of the textbox or what ever you have created in your jsp.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey

it is only one of the method signature you can change it to your requirement, like

now try in this way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic