在jsp中有个dept_id 还有其他的 Actionform get的时候 get到得确实null 而其他的都正常get到了。。
jsp页面如下:
- HTML code
<%@ page contentType="text/html; charset=GBK" language="java" %><%@page import="com.bOS.bUtil.db.HibSessionFactory"%><%@page import="net.sf.hibernate.*"%><%@page import="com.bOS.bPRO_PersonManage.en.Employees"%><%@page import="com.bOS.bPRO_PersonManage.service.EmployeesDao"%><%@page import="com.bOS.bPRO_PersonManage.en.Employees"%><%@page import="com.bOS.bPRO_PersonManage.service.EmployeesDao"%><%@page import="com.bOS.bPRO_PersonManage.en.Department"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>人力资源管理系统</title><meta http-equiv="Content-Type" content="text/html; charset=GBK"><link href="css/css.css" rel="stylesheet" type="text/css"></head><script src="Js/js.js"></script><script type="text/javascript">function deptValidate(){var dept_id=document.forms["deptForm"].dept_id.value;var dept_name=document.forms["deptForm"].dept_name.value;var manager_name=document.forms["deptForm"].manager_name.value;if(dept_name.length<=0){alert("请填写部门名称!");}else if(manager_name.length<=0){alert("请填写部门经理!");}else {document.forms["deptForm"].submit();}}</script><body><% Department d=(Department)request.getAttribute("department"); if(d!=null){ System.out.println(d.getDept_id()); %><form name="deptForm" method="post" action="modifydept.do?action=updatedept"><table border="0" align="center" cellpadding="2" cellspacing="1" bordercolor="#FFFFFF" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF" > <tr align="right"> <td height="80" colspan="4" align="left" ><strong class="text13">修改部门信息</strong><br></td> </tr> <tr align="center"> <td width="80" height="24" align="right" >部门编号:</td> <td width="150" height="24" align="center" > <input name="dept_id1" type="text" class="input" id="dept_id1" value="<%=d.getDept_id()%>" disabled="disabled"> <input type="hidden" name="dept_id" id="dept_id" value="<%=d.getDept_id()%>"></td> <td width="80" height="24" align="right" >部门名称:</td> <td width="150" height="24" ><input name="dept_name" type="text" class="input" id="dept_name" value="<%=d.getDept_name() %>"></td> </tr> <tr align="center"> <td height="24" align="right" >部门经理:</td> <td height="24" > <input name="manager_name" type="text" class="input" id="manager_id" value="<%=d.getManager_name() %>"></td> <td height="24" align="right" >员工人数:</td> <td height="24" ><input name="count" type="text" class="input" value="<%=d.getCount() %>" ></td> </tr> <% }else{ %> <tr> <td height="22" colspan="2" align="center" >没有查到该部门信息!!!</td> </tr> <%}%> <tr> <tr align="right"> <td height="50" colspan="4" align="center" ><input name="Submit" type="button" class="button" value="提交" onclick="deptValidate();"> <input name="Submit2" type="reset" class="button" value="重置"></td> </tr></table></form></body></html>