您的位置:首页 > 产品设计 > UI/UE

java.lang.IllegalArgumentException: id to load is required for loading 解决方法

2017-08-25 10:25 609 查看
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
.table1{
border:1px solid #ddd;
width:900px;

}
thead{
background-color:lightblue;
}

</style>
</head>
<body>
<table border="0" width="900px">
<tr>
<td align="center" style="font-size:24px; color:#666">员工管理</td>
</tr>
<tr>
<td align="right" > <a href="{pageContext.request.contextPath}/employee_saveUI.action">添加</a></td>
</tr>
</table>
<br/>

<table cellspacing="0" border="1" class="table1">
<thead>
<tr>
<td align="center">编号</td>
<td align="center">员工姓名</td>
<td align="center">性别</td>
<td align="center">出生年月</td>
<td align="center">入职时间</td>
<td align="center">所属部门</td>
<td align="center">编辑</td>
<td align="center">删除</td>
</tr>
</thead>

<tbody>
<s:iterator value="list" var="e">
<tr>

<td align="center"><s:property value="#e.eno"/></td>
<td align="center"><s:property value="#e.ename"/></td>
<td align="center"><s:property value="#e.sex"/></td>
<td align="center"><s:date name="#e.brithday" format="yyyy-MM-dd"/></td>
<td align="center"><s:date name="#e.joinDate" format="yyyy-MM-dd"/></td>
<td align="center"><s:property value="#e.department.dname"/></td>
<!-- 不是did   exception
java.lang.IllegalArgumentException: id to load is required for loading--> 
<td align="center"><a href="{pageContext.request.contextPath}/employee_edit.action?did=<s:property value="#e.eid"/>"><img src="{pageContext.request.contextPath}/images/edit.png"</a></td>
<td align="center"><a href="{pageContext.request.contextPath}/employee_delete.action?eid=<s:property value="#e.eid"/>"><img src="{pageContext.request.contextPath}/images/edit.png"</a></td>
</tr>
</s:iterator>
</tbody>
</table>
<br/>

<table table border="0" cellspacing="0" cellpadding="0"  width="900px">
<tr>
<td align="right">
<span>第<s:property value="currPage"/>/<s:property value="totalPage"/>页</span>
<apan>
<s:if test="currPage !=1">
<a href="{pageContext.request.contextPath}/employee_findAll.action?currPage=1"">[首页]</a>  
<a href="{pageContext.request.contextPath}/employee_findAll.action?currPage=<s:property value="currPage-1"/>">[第一页]</a>  
</s:if>
<s:if test="currPage !=totalPage">
<a href="{pageContext.request.contextPath}/employee_findAll.action?currPage=<s:property value="currPage+1"/>">[下一页]</a>  
<a href="{pageContext.request.contextPath}/employee_findAll.action?currPage=<s:property value="totalPage"/>">[末页]</a>  
</s:if>
</span>
</td>
</tr>
</table>
</body>
</html>

解决方法:

<a href="{pageContext.request.contextPath}/employee_edit.action?did=<s:property value="#e.eid"/>"><img src="{pageContext.request.contextPath}/images/edit.png"</a></td>把
employee_edit.action?did=<s:property value="#e.eid"/>">
改成:
employee_edit.action?eid=<s:property value="#e.eid"/>">


我做的是时候复制上面的代码 复制错了,忘了改过来
注意
这里的did需要与是他Department 里面的属性did对应!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ssh
相关文章推荐