Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing an object from one controller to another

joseph mv
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a user registration jsp page that asks the user to enter his personal information in text boxes and also upload his photo.
I have placed the personal information section in one form and the photo upload section in another form.
I am trying to submit the first form to Controller1 and the second form (which is multipart/form-data) to Controller2.
After setting the personal information in the entity bean in Controller1, I want to pass this object to Controller2 so that the photo (in bytes) can also be set in the entity bean.
Also, in Controller2 I have to submit the object into the database.

The challenge that I am facing is:

1) When I try to pass the entity bean object from Controller1 to Controller2, the showForm method of Controller2 is not getting called.

In Controller1, I forward the entity bean object using the following line of code:

return new ModelAndView("forward:photouploader.html","mydata",bd);

And in Controller2, I have written this code :

protected ModelAndView showForm (HttpServletRequest request,
HttpServletResponse response) {

//The object from Controller1 doesnt come here

Here photouploader.html refers to Controller2.
And bd is the object I want to pass to Controller2

Please note I am using Spring 2.5
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic