JSP implements asynchronous refresh through struts

Source: Internet
Author: User

Problem:
The self-developed paging control is used for JSP page query. This paging control achieves synchronization. The entire page is refreshed every time you submit a query.
The query condition is the year, city, and county values. After refreshing, the three controls are reset to the initial state. It is quite troublesome to maintain the value status during the query.
How can the value of the query condition remain unchanged after the query?

Solution:
1) Place the Three query condition controls in a div.
2) Add a struts den struts tag to the JSP page to store the HTML text of the div.
3) obtain the value of hidden in the onload event on the page. If it is not empty, set the value to the HTML text of the div.
4) write the HTML text of the DIV to the value of hidden in the query event.

Ideas:
Use the struts tag and Action property variable binding technology to store client variables.
Solved the problem that variable values cannot be stored after refreshing on the client.

Specific process:
1) write the value to the struts tag before refreshing the page.
2) When a query is submitted, the struts tag value is automatically written to the variable with the same name (Tag Name attribute) as the tag in the action class.
3) After refreshing the variable, the value is written to the value attribute of the struts tag.

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.