本帖最后由 刘国强 于 2013-5-8 14:12 编辑
为什么此页面无法调用javascript,点击删除时没有任何的反应,其中${e.id}获取的是对象id信息,id从数据库中取出后封装,id使用UUID自动生成
JSP页面完整代码- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
- <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- <%
- 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>
- <title>员工列表</title>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/commons/globals.css"/>
- <script type="text/javascript">
- function del(id){
-
- if(window.confirm("确定删除?????")){
- location.href= '${pageContext.request.contextPath}/control/privilege/employee.do?method=delete&id=' + id;
- }
- }
- </script>
- </head>
-
- <body>
- <div id="container">
-
- <div>
- <table id="t">
- <tr>
- <th width="5%">编号</th>
- <th width="10%">登陆名</th>
- <th width="10%">姓名</th>
- <th width="10%">部门</th>
- <th width="20%">操作</th>
- </tr>
- <c:forEach var="e" items="${list}" varStatus="status">
- <tr>
- <td width="5%">${status.count }</td>
- <td width="10%">${e.username }</td>
- <td width="10%">${e.realname }</td>
- <td width="20%">${e.department.name }</td>
- <td width="20%">
- <c:if test="${e.username!='admin'}" var="condition">
- <a href="${pageContext.request.contextPath}/control/privilege/employee.do?method=updateEmployeeRoleUI&employeeId=${e.id}">分配角色</a>
- <a href="${pageContext.request.contextPath}/control/privilege/employee.do?method=changeUI&employeeId=${e.id}">修改</a>
- <a href="javascript:void(0)" onclick="del(${e.id})">删除</a>
- </c:if>
- </td>
- </tr>
- </c:forEach>
-
- <tr>
- <td style="border-style: none;"></td>
- <td colspan="8" style="border-style: none;">
-
- <input type="button" value="添加员工" onclick="javascript:location.href='${pageContext.request.contextPath}/control/privilege/employee.do?method=addUI'">
- </td>
- </tr>
- </table>
- </div>
- </div>
- </body>
- </html>
复制代码 其他地方都正常就是点击删除没有反应,主要出问题部门的代码- <a href="${pageContext.request.contextPath}/control/privilege/employee.do?method=updateEmployeeRoleUI&employeeId=${e.id}">分配角色</a>
- <a href="${pageContext.request.contextPath}/control/privilege/employee.do?method=changeUI&employeeId=${e.id}">修改</a>
- <a href="javascript:void(0)" onclick="del(${e.id})">删除</a>
复制代码 什么原因造成的实在是找不出问题 |