struts2日期控件-datetimepicker
struts2日期控件--datetimepicker
struts2丰富的标签,把web开发变的很简单,有个datetimepicker控件,对输入日期时,很方便
<1>首先加入struts2-dojo-plugin-2.1.8.jar库
<2>在页面的头部加上<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<3>然后在页面的<head>下加入:<sx:head extraLocales="UTF-8"/> 这里是加入UTF-8属性,是为了中文显示
<4>然后就可以使用了;
<%@ page contentType="text/html; charset=gb2312" pageEncoding="gb2312"%> <%@taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sx" uri="/struts-dojo-tags" %> <html> <head> <title>注册</title> <sx:head extraLocales="UTF-8"/> </head> <body> <s:form action="register" method="post"> <s:textfield label="昵称" name="userName" /> <sx:datetimepicker language="UTF-8" label="出生日期" name="userBirthday" value="%{'1990-01-01'}" displayFormat="yyyy-MM-dd"/> </s:form> <input type="button" value="注册" /> </body> </html>ok,详细的就需要自己去研究了;http://struts.apache.org/2.0.12/docs/ajax-and-javascript-recipes.html#AjaxandJavaScriptRecipes-Datepicker这里有详细的资料