Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Jsp JSP Include Param

Related Tutorials


 
 

Share on Google+Share on Google+

JSP Include Param

Advertisement
JSP Include Param is used to pass parameter in the include directive. The example uses clause to pass the parameter name and value to the dynamic jsp page.

JSP Include Param

        

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:

Download Source Code:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 4, 2009

Related Tutorials

Discuss: JSP Include Param   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com