Back Forum Reply New

Sharing command objects between controllers

Can somebody tell me, is there any way of sharing form backing objects between different controllers?

I have two controllers which serve quite different purposes, both are SimpleFormControllers linked from the same page.  I want to post from a form on the page (which contains two forms), which submits some data to the second controller.  
Is there some way of submitting an actual command object to the second form controller (remember the current view was rendered via another controller)?

Basically I cant find any clean way of passing data between controllers, only solution I can find is request.getParameter(...

Am I missing something?

Cheers

Hi

gt;Basically I cant find any clean way of passing data between controllers, only solution I can find is request.getParameter(...You may need something like this in the first controller

onSubmit(...){  Map myModel = new HashMap();  myModel.put(myCommandObject);  return new ModelAndView(new RedirectView(getSuccessView(),  myModel)
}

Then in the second form controller, you can get the data object in the formBackingObject (the RedirectView will call the second controller)

formBackingObject ( fromServletRequest request)

How do i get the data object back out in the second controller in formBackingObject method?

Thanks

So it is in the request object

ServletRequestUtils.getRequiredIntParameter(reques  t, quot;your modelquot;);
¥
Back Forum Reply New