Reputation: 491
Page1: I am having a JSP page form to create a new item. I click Submit and redirect it to a server side JSP page. But when i test this in browser, I see a blank page after submit. I would like to redirect it to page2 after submit which has a list box and highlight the newly created item.
Can someone please tell me how to do these 2 things - 1. Redirect page1.jsp -> Server JSP -> page2.jsp ( i want to know how to redirect it to page2.jsp, i finished the 2 steps) 2. I should be able to highlight the newly created item in the list box.
Thanks!
Upvotes: 1
Views: 5786
Reputation: 4387
Inside serverJsp.jsp add this code at the end( after all your other code is done).
response.sendRedirect("page2.jsp");
Upvotes: 3
Reputation: 613
I would recommend forwarding to a java servlet, as opposed to a 'server side JSP'... once you do that, you can take care of any logic you need to in the body of the doGet or doPost method, then call response.redirect(page) to forward to the final jsp endpoint that you would like.
Likewise, you can just call 'response.redirect(page)' in a scriptlet on the 'server side JSP',I believe.
Upvotes: 0