• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

passing an object from one controller to another

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic