纯 jsp 问题
我的信息输入表单info.jsp,显示信息表单view.jsp,我想在显示表单加上“编辑”功能,使其值返回到info.jsp。该怎样实现。请指导,谢谢。
我就是用纯jsp写的,没有用到数据库。
代码如下:
info.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用户信息添加页面</title>
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
<script language="javascript" type="text/javascript" src="validator.js"></script>
</head>
<body bgcolor=#C2DAFA>
<center>
<h1> 用户信息添加页 </h1>
<form action="view.jsp" method="post" onSubmit="return Validator.Validate(this,3)">
<table width="514" border="1">
<tr>
<td >姓名</td>
<td ><input type="text" dataType="Require" msg="请输入姓名" name="username"/>
</td>
</tr>
<tr>
<td>性别</td>
<td>
<input type="radio" name="sex" value="男" />
男
<input type="radio" name="sex" value="女" />
女</td>
</tr>
<tr>
<td>年龄</td>
<td><input type="text" dataType="Require" msg="请输入年龄" name="age" /></td>
</tr>
<tr>
<td>政治面貌</td>
<td><select name="polity" >
<option>党员</option>
<option>团员</option>
<option>群众</option>
</select>
</td>
</tr>
<tr>
<td>健康状况</td>
<td><input type="checkbox" name="health" value="健康" />
健康
<input type="checkbox" name="health" value="一般" />
一般 </td>
</tr>
<tr>
<td>手机号码</td>
<td><input type="text" dataType="Require" msg="请输入手机号码" name="phone" id="textfield" /></td>
</tr>
<tr>
<td>邮箱</td>
<td><input type="text" dataType="Require" msg="请输入邮箱" name="E-mail" id="textfield" /></td>
</tr>
<tr>
<td>家庭地址</td>
<td><textarea dataType="Require" msg="请输入家庭地址" name="address" cols="45" rows="5"></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交" /> <input type="reset" value="重置" />
</td>
</tr>
</table>
</form>
</body>
</html>
view.jsp
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用户信息显示页面</title>
</head>
<head>
</head>
<body bgcolor=#C2DAFA background="./images/21.jpg">
<center>
<h1> 用户信息显示页面 </h1>
<form action="update.jsp" method="post">
<table width="514" border="1">
<%
request.setCharacterEncoding("utf-8");
%>
<tr>
<td> 姓名: </td>
<td><%=request.getParameter("username")%></td>
</tr>
<tr>
<td> 性别: </td>
<td><%
String sex = request.getParameter("sex");
%>
<%=sex%> </td>
</tr>
<tr>
<td>年龄</td>
<td><%=request.getParameter("age")%></td>
</tr>
<tr>
<td>政治面貌</td>
<td><%=request.getParameter("polity")%></td>
</tr>
<tr>
<td> 健康状况</td>
<td><% String health = request.getParameter("health");%>
<%=health%></td>
</tr>
<tr>
<td>手机</td>
<td><%=request.getParameter("phone")%></td>
</tr>
<tr>
<td>邮箱</td>
<td><%=request.getParameter("E-mail")%></td>
</tr>
<tr>
<td>家庭地址</td>
<td><%=request.getParameter("address")%>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="编辑" />
</td>
</tr>
</table>
</form>
</body>
</html>
请指点,谢谢。