<s:a> This tag generates a hyperlink that is used to send an asynchronous request like the server and load the server response into the specified HTML element
Xml
? XML version= "1.0" encoding= "GBK"?>
< Web-app Version = "2.4" xmlns = "http://java.sun.com/xml/ns/j2ee"
Xmlns:xsi = "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation = "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
< servlet >
< Servlet-name > Dwr </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 </servlet-name >
< Url-pattern >/dwr/* </url-pattern >
</servlet-mapping >
< filter >
< Filter-name > struts2 </filter-name >
< Filter-class > Org.apache.struts2.dispatcher.FilterDispatcher </filter-class >
</Filter >
< filter-mapping >
< Filter-name > struts2 </filter-name >
< Url-pattern >/* </url-pattern >
</filter-mapping >
</Web-app >
Struts.xml
<! DOCTYPE Struts Public
"-//apache Software foundation//dtd Struts Configuration 2.0//en"
"Http://struts.apache.org/dtds/struts-2.0.dtd" >
< struts >
< constant name = "Struts.custom.i18n.resources" value = "Messageresource"/>
< constant name = "Struts.i18n.encoding" value = "GBK"/>
< package name = "Ajax" extends = "Struts-default" >
< action name = "Ajaxtest" class = "Lee." Ajaxtestaction ">
< result >/ajaxresult.jsp </result >
</Action >
< action name = "Test3" >
< result >/testjs.jsp </result >
</Action >
</Package >
</Struts >
Randomaction
Package lee;
Import com.opensymphony.xwork2.action;
Import java.io.Serializable;
Public class AjaxTestAction implements action, serializable
... {
private static int counter = 0;
private String data;
public long getservertime ()