1、下载JSCal2-1.7,解压
2、建立web项目,在WebRoot下建立JSCal2文件夹,将解压后的JSCal2-1.7中的css文件夹和js文件夹复制到此文件夹下
3、建立index.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<!-- 链接JSCal2相关文件,注意路径问题 -->
<link rel="stylesheet" type="text/css" href="JSCal2/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="JSCal2/css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="JSCal2/css/gold/gold.css" />
<script type="text/javascript" src="JSCal2/js/jscal2.js"></script>
<script type="text/javascript" src="JSCal2/js/lang/en.js"></script>
</head>
<body>
<input id="calendar-inputField" /><button id="calendar-trigger">...</button>
<!-- 加入相关js代码,参数含义参见JSCal2文档 -->
<script type="text/javascript">
Calendar.setup({
trigger : "calendar-trigger",
inputField : "calendar-inputField",
onSelect : function(){this.hide()}
});
</script>
</body>
</html>
4、部署运行即可
http://localhost:8080/TestJsCalender/index.jsp