JQuery Ajax url Usage, jqueryajax

Source: Internet
Author: User

JQuery Ajax url Usage, jqueryajax

Use Cases of jQuery Ajax:
The page must use the background logic, but only partial refresh is required to display new content.

JQuery Ajax url Usage
1. servlet method:
You need to write an action in struts. xml to write the jump address to servlet;
The init method needs to be rewritten (to use the bean injected by spring );
Set response encoding response. setContentType ("text/html; charset = UTF-8 ");
Use request. getParameter () to receive parameters;
Use response. getWriter (). print () to pass the page content;

2. action method:
(1) json output data
Struts2-json-plugin.jar required;
In struts. xml, package extends = "json-default"; result type = "json ";
You need to declare the received page parameters and get, set;
Declare the value to be uploaded to the page to generate get;
(2) Use ServletActionContext. getResponse () in action to get response and use response. getWriter (). print () to pass the page content.
You need to declare the received page parameters and get, set;

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.