STRUTS2 Ajax Tags for learning notes from the STRUTS2 Authority Guide

Source: Internet
Author: User
Tags i18n

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 ()
... {

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.