Extract the struts1.3 business layer to share the Business Code of DWR and strtus.

Source: Internet
Author: User
The traditional struts development framework uses CodeWritten in action, the transaction logic is configured to query data in the service, so there is a design defect:
1: if there are many database operations, you need to write a long amount of code in the service.
2: Some database operations are related to the Business Code level. The judgment and other operations are indispensable between two database operations. Therefore, some business logic is written in the service layer and some in the Action layer, which is confusing.

Therefore, is there a way to extract Business Code to one level? Considering the different framework structures, it is found that the required operations are basically as follows:

1. submit data (or Ajax)
2. Assemble data (struts assembles form parameters to actionform)
2. Start the transaction
3. Identify database exceptions and business logic throws business or database exceptions to return
4. End the transaction
5. Assemble data to return (struts uses formbean and request to carry objects, while AJAX can be XML or other definition formats)

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.