Java 无法在Spring MVC Jquery中加载datepick
我想在我的样本申请表中实现日期选择,我已经做了所有的更改,但是我的页面仍然无法加载日期选择。我犯了什么错误请告诉我 这是我的照片的快照 这是我的web.xmlJava 无法在Spring MVC Jquery中加载datepick,java,jsp,jquery-ui,spring-mvc,Java,Jsp,Jquery Ui,Spring Mvc,我想在我的样本申请表中实现日期选择,我已经做了所有的更改,但是我的页面仍然无法加载日期选择。我犯了什么错误请告诉我 这是我的照片的快照 这是我的web.xml <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib uri="http://www.springframework.org/tags/form" pre
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring MVC Form Handling</title>
<style>
.error {
color: red; font-weight: bold;
}
</style>
</head>
<body>
<h2>Add Employee Data</h2>
<link href="<%=request.getContextPath()%>/files/jquery-ui.css" rel="stylesheet">
<script src="<%=request.getContextPath()%>/files/jquery.js"></script>
<script src="<%=request.getContextPath()%>/files/jquery-ui.js"></script>
<script> type="text/javascript">
$(function() {
//Datepicker
$('input[name=Dategiven]').datepicker({
format: 'yyyy-mm-dd'
});
});
</script>
<form:form method="POST" action="/SpringHibernate/save.html">
<table>
<tr>
<td><form:label path="id">Employee ID: </form:label></td>
<td><form:input path="id" value="${employee.id}" readonly="true"/></td>
</tr>
<tr>
<td><form:label path="name">Employee Name: </form:label></td>
<td><form:input path="name" value="${employee.name}" placeholder="Name"/></td>
<td align="left"><form:errors path="name" cssClass="error"/></td>
</tr>
<tr>
<td><form:label path="age">Employee Age:</form:label></td>
<td><form:input path="age" value="${employee.age}" placeholder="Age"/></td>
<td align="left"><form:errors path="age" cssClass="error"/></td>
</tr>
<tr>
<td><form:label path="salary">Employee Salary:</form:label></td>
<td><form:input path="salary" value="${employee.salary}" placeholder="Salary"/></td>
<td align="left"><form:errors path="salary" cssClass="error"/></td>
</tr>
<tr>
<td><form:label path="address">Employee Address:</form:label></td>
<td><form:input path="address" value="${employee.address}" placeholder="address"/></td>
<td align="left"><form:errors path="address" cssClass="error"/></td>
</tr>
<tr>
<td><form:label path="Dategiven">Employee Date:</form:label></td>
<td><form:input path="Dategiven" value="${employee.dategiven}" placeholder="YYYY-MM-dd"/></td>
<td align="left"><form:errors path="Dategiven" cssClass="error"/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit"/></td>
</tr>
</table>
</form:form>
<c:if test="${!empty employees}">
<h2>List Employees</h2>
<table align="left" border="1">
<tr>
<th>Employee ID</th>
<th>Employee Name</th>
<th>Employee Age</th>
<th>Employee Salary</th>
<th>Employee Address</th>
<th>Employee dategiven</th>
<th>Actions on Row</th>
</tr>
<c:forEach items="${employees}" var="employee">
<tr>
<td><c:out value="${employee.id}"/></td>
<td><c:out value="${employee.name}"/></td>
<td><c:out value="${employee.age}"/></td>
<td><c:out value="${employee.salary}"/></td>
<td><c:out value="${employee.address}"/></td>
<td><c:out value="${employee.dategiven}"/></td>
<td align="center"><a href="edit.html?id=${employee.id}">Edit</a> | <a href="delete.html?id=${employee.id}">Delete</a></td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
springmvc表单处理
.错误{
颜色:红色;字体大小:粗体;
}
添加员工数据
type=“text/javascript”>
$(函数(){
//日期选择器
$('input[name=Dategiven]')。日期选择器({
格式:“yyyy-mm-dd”
});
});
员工ID:
员工姓名:
员工年龄:
员工工资:
员工地址:
员工日期:
列出雇员名单
员工ID
员工姓名
员工年龄
员工工资
员工地址
雇员日期
世界其他地区的行动
|
此服务器的SpringHibernate-servlet.xml配置
同样,对于这一行,
我也收到了如下警告:
在此行找到多个批注:
-找不到WebContent/WEB-INF/views//files/jquery-ui.css。
有人能帮我解决这个问题吗?把js&css文件放在WEB-INF文件夹之外 容器不允许直接访问WEB-INF文件夹下的资源。把资源放在第一位;e js、css、WebContent文件夹下的图像 此外,在jsp中计算contextpath的理想方法是
<script src="${pageContext.request.contextPath}/templates/js/main.js"></script>
打开浏览器控制台,检查所有错误,检查css的请求url&尝试在新选项卡上点击它。如果资源不可用,则问题在于jsp中资源的url映射。重新检查url