JSP

JSP Projects

JSP Project

Retrieved user name from the input
Previous Home Next

 

In this page of the tutorials we are going to show you how to retrieved the user name from the input form. in this programs we are using the getParameter("username") function which is used to call the name of the parameter which is input at the run time of the program. 

 getParameter() It is used to return the name of the parameter.

This application contain two form first is Retrieved.jsp, in this page we can inter the name or any charater string and second form is nameshow.jsp which access the parameter name and show on itself.

 
===================================Retrived.jsp========================
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Retrieved data from data base</title>
</head>
<body>
<p>&nbsp;</p>
<form method="POST" action="Nameshow.jsp">
<table><tr><td>
<font color="#0066ff" size="5">Enter your Name:</font>
</td>
<td><input type
="text" name="username" size="20"></td>
<tr><td></td><td align="right"><p><input type="submit" value="Submit" name="B1"></p></td></tr>
</tr></table>
</form>
</body>
</html>

==============================Nameshow.jsp===========================
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html" %>
<html>

<body>

<p><font size="6" color="#0066ff">Welcome :&nbsp; <%=request.getParameter("username")%></font></p>

</body>

</html>



Previous Home Next