简体   繁体   中英

How to redirect directly to previous jsp page when result set is null in second jsp page in java

I have two jsp pages one.jsp and two.jsp.

  1. In one.jsp contains table row have a link when i click that link it redirects to two.jsp page and display data.

  2. My problem is two.jsp page when result set(two.jsp) is empty not display two.jsp it is directly redirect to one.jsp page with an error message

Thank you

In you two.jsp if you get empty resultset you can redirect to one.jsp using following code:

RequestDispatcher requestDispatcher; 
requestDispatcher = request.getRequestDispatcher("/two.jsp");
requestDispatcher.forward(request, response);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM