PDA

Click to See Complete Forum and Search --> : Java - Reading Request Parameter Values


Dillinger4
Dec 30th, 2004, 05:39 PM
The following code shows how http request parameters can be
grabbed from an .html form and displayed. Code was tested on
tomcat implementation 5.0.28 using JSP 2.0 and JSTL 1.1.

<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
<title> JSP Example </title>
</head>
<body bgcolor = "black">
<form action="usersetup.jsp" method="get">
<table>
<tr>
<td>
<font color = "green">
First Name:
</font>
<input type = "text" name = "fname"/>
</td>
</tr>
<tr>
<td>
<font color = "green">
Last Name:
</font>
<input type = "text" name = "lname"/>
</td>
</tr>
<tr>
<td>
<font color = "green">
Address:
</font>
<input type = "text" name = "address"/>
</td>
</tr>
<tr>
<td>
<font color = "green">
City:
</font>
<input type = "text" name = "city"/>
</td>
</tr>
<tr>
<td>
<font color = "green">
State:
</font>
<input type = "text" name = "state"/>
</td>
</tr>
<tr>
<td>
<input type = "submit" name = "send data"/>
</td>
</tr>
</table>
</form>
<font color = "green">
You Entered: <br>
First Name: <c:out value = "${param.fname}"/><br>
Last Name: <c:out value = "${param.lname}"/><br>
Address: <c:out value = "${param.address}"/><br>
City: <c:out value = "${param.city}"/><br>
State: <c:out value = "${param.state}"/><br>
</font>
</body>
</html>