如我的代码jsp中,
我的目录:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>ssh_test</title>
<script type="text/javascript" src="jquery-1.12.2.min.js"/>
<script type="text/javascript">
$(function () {
//这里不起作用啊,还是没办法弹出alert,没办法删除超链接
$(".delete").click(function () {
alert("chaonimadfdfsd");
return false;
});
});
</script>
</head>
<body>
<h4>Employee List Page</h4>
<s:if test="#request.employee==null||request.employee.size()==0">
没有任何员工信息
</s:if>
<s:else>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td>ID</td>
<td>LAST_NAME</td>
<td>E_MAIL</td>
<td>BIRTH</td>
<td>CREATE_TIME</td>
<td>DEPARTMENT</td>
<td>DELETE</td>
</tr>
<s:iterator value="#request.employee">
<tr>
<td>${id}</td>
<td>${lastname}</td>
<td>${email}</td>
<td>${birth}</td>
<td>${createtime}</td>
<td>${department.departmentname}</td>
<td>
<a href="emp-delete.action?id=${id}" class="delete">Delete</a>
</td>
</tr>
</s:iterator>
</table>
</s:else>
</body>
</html>
已经解决!!!
<script type="text/javascript" src="jquery-1.12.2.min.js"/>
要写成
<script type="text/javascript" src="jquery-1.12.2.min.js"></script>
另外,src文件放在web目录下好点,不要放在web-inf下