JSP Include Param is used to pass parameter in the include directive. The example uses <jsp:param> clause to pass the parameter name and value to the dynamic jsp page. This clause is only used with the <jsp:include> directive. It allows you to include either a static or dynamic file in a JSP page. The <jsp:include> acts on a request and sends back the result included in the JSP page.
Understand with Example
The Tutorial illustrate an example from 'JSP Include Param'. To understand the example we create a include.jsp that include <jsp:include page> directive 'includedparam.jsp'. The <jsp:param> clause to pass the username and password parameter value to the dynamic jsp. The Request.getParameter ( ) retrieve the value that client has submitted. The <jsp:include> act on the request and send back the result included in the include.jsp page.
Here is the code of include.jsp
| <html> <body> <font color="green"><h2>Login Information</h2></font> <jsp:include page="includedParam.jsp" flush="true"> <jsp:param name="username" value="Roseindia"/> <jsp:param name="password" value="rose"/> </jsp:include> </body> </html> |
Here is the code of includedParam.jsp
| <html> <% out.println("<b>Username: </b>" + request.getParameter("username")+"<br>"); out.println("<b>Password: </b>" + request.getParameter("password")); %> </html> |
Output will be displayed as:

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: JSP Include Param View All Comments
Post your Comment