Reputation: 51
I am using Spring Mvc.Here I have used JSP as a view.
I have a situation,in which I have to redirect to another form which is subjected to another controller,from a form which is subjected to another controller
I have used
<c:redirect url="updateStock.ic?appId='${mineralSelect.applicationId}'&serviceId='${mineralSelect.serviceId}'&mineralIdAndName='${mineralList.get(0).mineralId}:${mineralList.get(0).mineralName}'"/>
But it is executed,but the page is not rendered.But in the console view there is no exception page.
Upvotes: 1
Views: 782
Reputation: 8154
Since I didn't get an answer to my comment, I will try to give you the best answer with limited knowledge that I possibly can.
First, I think it's bad practice to put redirects in your JSPs. Frankly, I think its bad practice to put anything other than simple loops and decision branches in your JSPs. I would consider the decision to do a redirect a "business logic" decision, and one I would not make in my JSP. Spring MVC provides several methods to do a redirect in the controller, which has the added benefit of not being in the JSP, and would bypass having to render the JSP to perform the redirect. This posting has some examples of how to perform a redirect in the controller.
If you still have your heart set on doing the redirect in your JSP, then I would suggest breaking out some testing tools to see if you are getting the redirect at all. Chrome's Developer Tools and Firefox's Firebug have the ability report what gets sent to your browser. Fiddler is also a good tool for these things. What you are looking for is an HTTP 3xx header, most likely a 302, with the URL that you are trying to redirect to.
If you are not seeing the HTTP 3xx response in the browser, then its time to troubleshoot. Start by asking the following:
Start as close to the source as possible, adding debug prints and logging, then expand out to the next widest area until you determine what is working and what is not working.
Upvotes: 1