forward action with Parameter JSP
We have seen earlier simple <jsp:forward> action. Now let us see the same forward action with an extra feature of parameters passing. With jsp:forward action, parameters can also be passed to including page. Included page reads the parameters from the including page. start reading forward action with Parameter JSP.
Example on forward action with Parameter JSP
1. Including page, File Name: JyostnaParam.jsp
Infact, these values of jsp:param can be read by any another JSP of the application.
2. Included page, File Name: JyostnaInfo.jsp
This reads jsp:param values from including page JyostnaParam.jsp. The method used is request.getParameter(), the same one used to read client HTMLform data.
Employee Name: <%= request.getParameter("empName") %>
Employee Office: <%= request.getParameter("empOffice") %>
Place of work: <%= request.getParameter("place") %>
Now run the JyostnaParam.jsp from Web server.
Practice well of include action, forward action (with and without parameters), include directive, forward directive and redirecting to a new file with sendRedirect() method of response object to have good command over JSP as a Developer.
Remember SingleThreadModel is by default true which will hinder the performance. Make in false, for general applications, with p age directive attribute threadSafe.
Pass your comments and suggestions on this tutorial "forward action with Parameter passing Example JSP" to improve the quality.
1 thought on “forward action with Parameter passing Example JSP”
close the above tag with instead of the .