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
<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"/>
Here is the code of includedParam.jsp
out.println("<b>Username: </b>" + request.getParameter("username")+"<br>");
out.println("<b>Password: </b>" + request.getParameter("password"));
Output will be displayed as:
Recommend the tutorial