1:web.xml配置<!--dwr 配置start--> <servlet> <servlet-name>dwr-invoker</servlet-name> <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping> <!--dwr 配置end--> 2:配置dwr.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN" "http://www.getahead.ltd.uk/dwr/dwr10.dtd"> <dwr> <allow> <create creator="new" javascript="JDate"> <param name="class" value="java.util.Date"/> </create> <create creator="new" javascript="inputtest"> <param name="class" value="com.test.InputTest"/> </create> </allow> </dwr> 3:jsp引用 <script type='text/javascript' src='/dwr/dwr/engine.js'> </script> <script type='text/javascript' src='/dwr/dwr/util.js'> </script> <script type='text/javascript' src='dwr/interface/JDate.js'></script> <script> function init(){ JDate.getYear(load); } function load(data){ alert(data+1900+'年') ; } </script> <body οnlοad="init()">