servlet回退到原JSP页面的问题

lanjfenoch 2006-02-20 09:47:15
回退后保持原jsp页面的信息不变,请问如何实现?

login.jsp内容如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<title>用户校验</title>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="vs_defaultClientScript" content="JavaScript">
<SCRIPT src="../javascript/globals.js"></SCRIPT>
<LINK href="../css/css.css" type="text/css" rel="stylesheet">
<style>
.titleBG
{
filter : progid:DXImageTransform.Microsoft.gradient(startColorStr=#115888,endColorStr=#D1EDF8,GradientType=1);
}
.titleBG1
{
filter : progid:DXImageTransform.Microsoft.gradient(startColorStr=#D1EDF8,endColorStr=#115888,GradientType=1);
}
</style>

</HEAD>
<body bgcolor="#d4d0c8" topmargin="0" leftmargin="0" >
<form id="Form1" method="post" action="../temp" onSubmit="return check_form();" >
<script>top.dialogWidth="425px";top.dialogHeight="355px";</script>
<script>window.resizeTo(425,355);</script>
<table border="0" cellpadding="0" cellspacing="0" style="BORDER-COLLAPSE: collapse" bordercolor="#111111"
width="420" id="AutoNumber1" height="251">
<tr>
<td width="420" style=""
height="62" bgcolor="#ffffff" colspan="6" align="center">
<img border="0" src="../images/center_logo.jpg"></td>
</tr>
<tr>
<td width="100" height="5" class="titleBG" colspan="4"></td>
<td width="108" height="5" class="titleBG1" colspan="2"></td>
</tr>
<tr>
<td width="12" height="1"></td>
<td width="53" height="1"></td>
<td width="88" height="1"></td>
<td height="1" style="WIDTH: 174px"></td>
<td height="1" style="WIDTH: 41px"></td>
<td width="71" height="1"></td>
</tr>
<tr>
<td width="12" height="53"> </td>
<td width="48" style="PADDING-LEFT:5px" height="53"><img border="0" src="../images/locked.gif" width="23" height="23" /></td>
<td width="373" height="53" colSpan="4" style="PADDING-LEFT:5px">
请输入用户名和密码: </td>
</tr>
<tr>
<td width="12" height="114" rowspan="5"> </td>
<td width="53" height="114" rowspan="4"> </td>
<td width="88" height="25" nowrap>用户名:</td>
<td width="289" height="25" colspan="3">
<input type="text" name="user_name" id="user_name" value="" size="34" Class="biaodan"> </td>
</tr>
<tr>
<td width="88" height="25" nowrap>密码:</td>
<td width="289" height="25" colspan="3">
<input name="passwd" type=password id="passwd" size="34" Class="biaodan"> </td>
</tr>
<tr>
<td width="88" class="text" height="25" align="left" nowrap> </td>
<td class="text" width="289" height="25" colspan="3" >
<table border=0><tr><td> </td>
<td height="25" colspan="2"> </td>
<td width="86%" class="text" height="25" > </td>
</tr></table></td>
</tr>
<tr>
<td height="40" colspan="2" align="right" style="PADDING-RIGHT:5px;PADDING-TOP:10px"
vAlign="top"><FONT face="宋体">
<input type="submit" name="Passwd_Dialog_submit" Class="biaodan" value=" 确 定 "></FONT> </td>
<td height="40" align="right" style="PADDING-RIGHT:5px;PADDING-TOP:10px"
vAlign="top"><FONT face="宋体">
<input type="button" onclick='window.open("/hzfccs/spf/spfregist.php")' name="Passwd_Dialog_submit" Class="biaodan" value=" 注 册 "></FONT> </td>
<td width="92" height="40" vAlign="top" style="PADDING-TOP:10px"><FONT face="宋体">
<input type="button" value=" 取 消 " class="biaodan" onclick="window.top.close();"></FONT> </td>
</tr>
<tr>
<td width="100%" colspan="5" nowrap>
<table width="100%"><tr><td width colspan="2"><hr></td></tr>
<tr><td height="25" nowrap><b>告示: </b></td>
<td width="100%" height="25" style="PADDING-right:3px">
<font color="red">本系统开放时间为8:30 - 20:30 ,请务必按时办理您的相关业务!</font> </td>
</tr>
</table> </td>
</tr>

<tr>
<td width="100%" colspan="6" height="20" nowrap> </td>
</tr>
</table>
</form>
<script>

var strSet;
status="欢迎光临兰州房产信息网";
</script>
</body>
</html>

login.java内容如下:
package com.wanwei.servlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.ServletException;
import javax.servlet.ServletConfig;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Servlet Class
*
* @web.servlet name="Login"
* display-name="Name for Login"
* description="Description for Login"
* @web.servlet-mapping url-pattern="/Login"
* @web.servlet-init-param name="A parameter"
* value="A value"
*/
public class Login extends HttpServlet {

public void init(ServletConfig config) throws ServletException {
super.init(config);
// TODO Auto-generated method stub
}

public void destroy() {
// TODO Auto-generated method stub
super.destroy();
}

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
IOException {
// TODO Auto-generated method stub
super.doGet(req, resp);
}

protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
IOException {
Enumeration params = req.getParameterNames();
PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
while(params.hasMoreElements())
{

String nextparam = (String)params.nextElement();
String[] paramarray = req.getParameterValues(nextparam);
out.println(nextparam);
out.println("<br>");
}
out.print("ok!");
// TODO Auto-generated method stub
}

}
...全文
201 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
infowain 2006-02-20
  • 打赏
  • 举报
回复
同意dlxu(Coding超过了10W行)

回退按钮是java解决得不好的问题,
有兴趣的的话可以看看Rails on Buby的相关内容。
dlxu 2006-02-20
  • 打赏
  • 举报
回复
前画面肯定是由Form给Submit的,所以你在回退的时候就不存在那些Submit的值了,所以自然没有办法正常显示前画面的东西。你可以把前画面需要的参数放在Session中,就可以了
lanjfenoch 2006-02-20
  • 打赏
  • 举报
回复
能说的具体点吗?
jragon 2006-02-20
  • 打赏
  • 举报
回复
把输入值通过request传回去。

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧