Topic: 请有经验者指点怎么维持会话ID!

  Print this page

1.请有经验者指点怎么维持会话ID! Copy to clipboard
Posted by: linkeca
Posted on: 2006-04-13 14:03

请有经验者指点! 我的JSP代码如下,我添加资料后,虽能输出提示信息“新附件资料提交成功!";但是表格里时的"主设备ID号“ equipid又变成初始值”0“了,如果我还要继续添加新资料的话,很明显会很不方便,请高手指点怎样才能使这个equipid仍然保持从上一个传来的Id的值,非常感谢!
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page session="true" %>
<%@ page import="equipment.equip.accessorys"%>
<jsp:useBean id="acce" scope="page" class="equipment.equip.accessorys" />
<jsp:useBean id="book" scope="page" class="equipment.run.accessorysmn" />
<%int equipid=0;
  String mesg = "";
  if(request.getParameter("Id")==null || request.getParameter("Id").equals("")) {
    mesg = "你要查看的设备附件不存在1!";
} else {
  try {
equipid = Integer.parseInt(request.getParameter("Id"));
    session.setAttribute("equipid","equipid");
acce.setEquipid(equipid);
  } catch (Exception e){
    mesg = "你要查看的设备附件不存在3!";
  }
}

String submit = request.getParameter("Submit");
  if (submit!=null && !submit.equals("")){    
    if(book.getRequest(request)){
      if(book.insert()){
        mesg = "新附件资料提交成功!";
      } else {
      mesg = "数据库操作失败";
      }
    }else {
      mesg = "对不起,你提交的参数有错误";
    }
  }
%>
<html>
<head>
<title>设备管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function checkform() {
  if (document.form1.acno.value=="") {
    document.form1.acno.focus();
    alert("附件编号为空!");
    return false;
  }
  if (document.form1.acname.value=="") {
    alert("附件名为空!");
    document.form1.acname.focus();
    return false;
  }

  return true;

}
</script>
<link rel="stylesheet" href="equip.css" type="text/css">
<style type="text/css">
<!--
a:link {
  color: #0000FF;
}
-->
</style></head>

<body bgcolor="#FFCC99" text="#000000">
<div align="center">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center" width="23%"><img src="./images/javabeans.gif" width="126" height="97"></td>
<td align="center" width="77%"> </td>
</tr>
<tr>
<td align="center" width="23%" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><a href="equiplist.jsp">管理首页</a></td>
</tr>
<tr>
<td align="center"><a href="equiplist.jsp">设备查询</a></td>
</tr>
<tr>
<td align="center"><a href="addequip.jsp">添加设备</a></td>
</tr>
<tr>
<td align="center"><a href="logout.jsp">退出系统</a></td>
</tr>
</table> </td>
<td align="center" width="77%">
<p><img src="./images/baners.gif" width="468" height="60"><br>
<font size="3"><b>添加新的附件</b></font></p>
     <% if(!mesg.equals("")){
      out.println(mesg);
     }%>
<form name="form1" method="post" action="addaccessory.jsp">
<table width="90%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td align="right" width="35%">主设备ID号:</td>
<td width="65%">
<input type="text" name="equipid" maxlength="40" size="20" value=<%=acce.getEquipid()%>> </td>
</tr>
<tr>
<td align="right" width="35%">附件编号:</td>
<td width="65%">
<input type="text" name="acno" maxlength="40" size="20"> </td>
</tr>
<tr>
<td align="right" width="35%">附件名:</td>
<td width="65%">
<input type="text" name="acname" maxlength="25" size="20"> </td>
</tr>
<tr>
<td align="right" width="35%">型号:</td>
<td width="65%">
<input type="text" name="actypeno" size="20" maxlength="150"> </td>
</tr>
<tr>
<td align="right" width="35%">单价:</td>
<td width="65%">
<input type="text" name="acprice" size="20" maxlength="30"> 元(人民币)</td> </td>
</tr>
<tr>
<td align="right" width="35%">购置时间:</td>
<td width="65%">
<input type="text" name="acpurchasetime" size="20" maxlength="10"></td>
</tr>
<tr>
<td align="right" width="35%"> </td>
<td width="65%">
<input type="submit" name="Submit" value="提交" onClick="return(checkform());">
<input type="reset" name="reset" value="重置"> </td>
</tr>
</table>
</form>
<p> </p> </td>
</tr>
</table>
<br>
<table width="70%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center">叶东辉<br>
CopyRight@2005<br>
Email:<a href="mailto:linkeca@163.com">linkeca@163.com</a></td>
</tr>
</table>

</div>
</body>
</html>
<% book.close();%>


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923