Struts development skills

Source: Internet
Author: User

Struts development skills
After the development of China Telecom's major customer service project and the ongoing development of the China Telecom headquarters business analysis project, I have accumulated some techniques and skills for Struts1.1 and Tiles development, which are shown in a close-up to facilitate future development. At the same time, I believe it can help readers develop Struts.
Module configuration
1. Struts configuration file Definition
For a module in the system, you need to define the configuration of this module before development. The struts configuration file is named:
Struts-config-xxx.xml
Xxx is the lowercase English name or abbreviation of the module, such as: struts-config-sysman.xml
Note: "-" in the middle, rather than the "_" Connector
Save the configuration file in the "WEB-INFxml" folder and add the corresponding configuration file to the web. xml file.
Address, for example:
...
<Init-param>
<Param-name> config </param-name>
<Param-value>/WEB-INF/struts-config.xml,/WEB-INF/xml/struts-config-pages.xml,/WEB-INF/xml/struts-config-sysman.xml </param-value>
</Init-param>
...
Note: you must use the "," connector to separate configuration file names.
In addition, all static JSPs need to define their ". do" access in the configuration file and save
The content in the struts-config-pages.xml file is as follows:
...
<! -- Turn to homepage -->
<Action path = "/main" type = "org. apache. struts. actions. ForwardAction" parameter = "/main. jsp"/>
...
2. Tiles configuration file Definition
The framework configuration file of the system is a tiles-defs_zh_CN.xml (supporting international applications through the. properties file, the default is a tiles-defs.xml), the Framework Structure of the module needs to be defined in it, for example:
...
<! -- Define the default homepage -->
<Definition name = "default. frame" path = "/layouts/defaultLayout. jsp">
<Put name = "title" value = "Welcome to China Telecom Business Analysis System"/>
<Put name = "header" value = "/top. jsp"/>
<Put name = "body" value = "default. body"/>
<Put name = "footer" value = "/buttom. jsp"/>
</Definition>
<! -- Define the body of the default homepage -->
<Definition name = "default. body" path = "/layouts/main. jsp">
<Put name = "logon" value = "/logon. jsp"/>
<Put name = "date" value = "/layouts/date. jsp"/>
<Put name = "linkSite" value = "/layouts/link.html"/>
</Definition>

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.