I have a requirement, where I have a search module with modify button at the button. So when I select the items in checkbox and click on modify it will invoke a different controller I presume. Is there a way in Spring MVC 2.5 I can pass the information from one controller to another with the value from model(items check). I dont know much on redirect, whether it will solve the problem. Can someone help.
You can have one controller with multiple methods. So the Search button calls one method on the Controller, and the Modify button calls a different method on the same controller.
Or your Search button calls one controller, and the modify calls a different controller, the "parameters" can still be there, it is the data from the page that you are passing to the controllers.
You wouldn't have a controller call another controller, or that data just sits in one controller and can't be accessed unless the code is in that controller. Because the controller does not own the data.
Thanks for your reply. I am infact planning to put a method for modify button in same controller; but when modify button is pressed the event will pass items to be modifed to another screen where all this data will be displayed in different format(lets say a grid). In this case, I am wondering if I do a redirect to another screen whether data will be sent or do I have to wrap it and send it.
There are several scenarios in my mind,
1. Should I just define a view and return model view
2. redirect:page name
I have not started any code on that and I am confused, but since I am working on design I need to do this immediately and dont have time to develop and test.
You need to think in the request/response mechanisms of the web, and not something that is Spring MVC specific. If I have data in one page, and I want a different page to display the same data, then I need to put the data somewhere both pages can find it. Like the session. This might also be a case where you would want to look at the Form Controller subclasses, or use Spring WebFlow.