Struts and tiles assist in component-based development (5)

Source: Internet
Author: User

Struts and tiles assist in component-based development (5)

More complex use of struts and tiles

The length limit does not allow me to further discuss other practical aspects of struts and tiles packages, but I really want to briefly discuss it, in this way, you can understand what struts and tiles can do. If you have enough requirements, the content may be the topic of future articles.

In the two examples in this article, you will notice that I have coded the name, last name, favorite color, birth date, and other basic verification. The simple verification I have adopted can actually be executed by struts by using its format verification, which saves the time spent coding Java statements. For example, it is feasible to check whether a string is a Null String, whether it matches a date, or whether it matches some other regular expressions. You will find that it is very convenient to use format verification as the first-level check. before checking whether it meets more complex business logic rules, the program can use the first-level check to eliminate some obvious errors. Struts provides a validator package that can be configured through the validator. XML descriptor in the WEB-INF directory. In these two examples, I did not include the validator package; if you want to try it, it is included in the Struts 1.1-B1 package.

Another useful feature of struts and tiles packages is integration with the security of container management. Many people are using application servers such as IBM WebSphere or JBoss. These servers make authentication and authorization easier by handling the many daily tasks involved in security, freeing you from the encoding required for them. Struts allows you to display different bits of bean data to different users based on user roles. This can be determined by automatically querying the container. Similarly, the tiles framework allows you to display different view components to different users based on user roles. This is also determined by the automatic query container. I use these features in my applications to display different menus to administrators, regular users, or guest users.

Finally, I did not mention internationalization in the example, but it is actually an important aspect for those who build large-scale applications that will eventually be released in multiple languages in the future. Struts allows you to create message Resource feature files that specify labels, titles, and other output texts. If you fill in the message Resource feature file with outputs in several different languages, you can simply change the language settings to change all the window components and hardcoded text to the appropriate language, it can be changed even when the application is running.

Future Direction

Where will struts and tiles go? The two changes will certainly make struts and tiles more useful. The first change is the workflow management system. You may have processed the Business Process of the merge step. Currently, encoding them in Web applications can be a major problem because you must coordinate different steps, each step is a separate method in the Java class or a separate servlet or JSP page. Tools in the commercial market help manage these processes by enabling developers to model multi-step business processes and then automatically generate Java code as the basis for further development. The struts workflow management system provides similar functions to enable developers to write scripts for business processes across multiple pages in Web applications, it also specifies how these pages interact with each other through the core rule-based system.

Another expected change is to merge the struts tag into the JSP standard tag library, which is a Jakarta project, it tries to generate a useful custom tag set to simplify and accelerate the development of Web applications written on JSP pages. The significance is that web application development is easier than ever before, because you can use the standard mechanism of custom tags to obtain a code library that is pre-written for further development on this basis. In addition, the merging of this project in the jsp stl standard even ensures a wider distribution and availability of struts and tiles functions. This means that developers with this skill have a great deal to do in many projects, in addition, the company is more likely to be skilled in developing web applications.

What can you get from this article?
After reading this article, you should remember the following points:

  • MVC is an excellent architecture for developing robust web software.The page-Oriented Architecture is simple, but it will gradually become ineffective as applications grow in scale and scope of use. MVC is a proven model suitable for larger applications.
  • Struts and tiles provide a solid foundation for complex applications.Struts and tiles comply with the MVC example and allow developers to create applications that grow as business needs grow under management.
  • Struts and tiles are strongly supported by the industry and gradually become popular and driving force among developers.This ensures that it is widely used and protects the time and money invested by developers and companies.

With struts and tiles, you will find it easier to create your own web application.

References

  • For more information, see the original article on the developerworks global site.

About the author

Wellie Chao is the President and Chief Technical Expert of caravel technologies. caravel technologies is an e-commerce and technology consulting company that provides technical strategy, design, and implementation services for enterprises of all sizes. He has been active in the technical field for many years. Since 1984, he has been involved in software and hardware R & D. Since 1994, he has written web-based software on different platforms in various languages. He creates and manages three software technology companies, and is recruiting talented staff and management personnel, it has direct and rich experience in raising risk funds and handling business dealings with suppliers, customers and business partners. He also designed and implemented a large-scale Web-based enterprise software system.
Wellie was a lecturer and speaker at Harvard's various business and entrepreneurial organizations. He is a member of the Harvard Club of New York Program Committee (Program Committe) and actively plans and organizes business and technical plans. Wellie is an honorary AB from Harvard University. He majored in economics and computer science at Harvard. You can contact him through the wchao@caraveltech.com. (Full text)

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.