The div tag is used to generate a DIV element on the page, but the DIV element content is not static content but gets the data from the server, so that the div can get the data on the server, you must specify an href attribute for the div tag, this href attribute must be an action, The action is responsible for generating the contents of the Div
Because Div is an AJAX tag, you want to add Theme= "Ajax" attributes to this tag
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 >
<! 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 = "random" class = "Lee." Randomaction ">
< 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 Randomaction implements Action
... {
Private String data;
Public String Getrdmstr ()
... {