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;