Ajax technology and STRUTS1 framework using the Getting Started tutorial

Source: Internet
Author: User

Because the company uses the technology is old, still use STRUTS1 framework, so write an Ajax and Struts1 with the use of the introductory tutorial. Below to get to the chase:

1. First introduce the way Ajax is written in JS:

$.ajax ({url: "<%=basepath%>xxx.do",//Receive AJAX request path, need to configure DataType in XML file: ' text ',//callback function return value type, text represents string Type: "POST"//request mode, post or get data:{alias: Parameter value, alias: Parameter value,...},//need to pass the parameter, no can not write data this property async:false,//default to True         , False is synchronous, true represents the asynchronous Success:function (data)//callback function, and data is the return value {alert (data); }     })

2. Next introduce the Struts-config.xml configuration method

<action type= "package name. Action name" path= "/xxx" scope= "Request" input= "/folder name/jsp name. jsp" > <!--type represents the action path that receives the request. Path is consistent with the Ajaxurl attribute (note that this is not written here. Do) input represents the JSP that sends the request--

At this point, Ajax has sent the request to the action, followed by the specific business to do the specific operation.

This article from "Cock silk reverse attack" blog, declined reprint!

Ajax technology and STRUTS1 framework using the Getting Started tutorial

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.