[Struts] difficulties in using the tiles Management Interface

Source: Internet
Author: User

Last weekend, I was studying how to use tiles to manage the interface of the demonstration center project. I didn't expect to have a lot of trouble and I haven't solved it yet. First, the demonstration center project has many modules, which are separated by struts module functions. The original idea is to define several common interface definitions (Definition) in the default module, and then inherit the definition in each module, and modify the necessary tile. I didn't expect that the definition in the module could not inherit the default definition no matter how it is set. In the default module:

< Plug-in Classname = "Org. Apache. Struts. Tiles. tilesplugin"   >
< Set-Property Property = "Definitions-config" Value = "/WEB-INF/tiles-defs.xml"   />
</ Plug-in >

In the instructor module:

< Plug-in Classname = "Org. Apache. Struts. Tiles. tilesplugin"   >
< Set-Property Property = "Definitions-config" Value = "/WEB-INF/tiles-defs.xml,/WEB-INF/tiles-defs-teacher.xml"   />
</ Plug-in >

Tiles-defs.xml in:

< Definition Name = "Classiclayout" Path = "/Layout/classic. jsp" >
< Put Name = "Header" Value = "/Header. jsp"   />
< Put Name = "Menu" Value = "/Teacher/list. Do" />
< Put Name = "Main" Value = "" />
< Put Name = "Footer" Value = "/Footer. jsp"   />  
</ Definition >

Tiles-defs-teacher.xml in:

< Definition Name = "Listlayout" Extends = "Classiclayout" >
< Put Name = "Main" Value = "/Teacher/list. jsp" />
</ Definition >

Then, in the instructor module, forward to listlayout, prompting that the path does not start with "/", that is, the definition of listlayout is not found. I tried a lot of writing methods, including setting moduleaware attributes.

Then I want to write the classiclayout definition in each module, pointing to the same. jsp definition file. I encountered a new problem. I want to display the content in the menu module in the teacher module, and I will prompt that the required resources cannot be found because I am in the teacher module, the resources of the menu module cannot be accessed, unless the key is specified in the configuration file of the menu module. the name of the bundle is forcibly specified in the JSP file. I think this method is too indecent and I have to make a lot of changes at the same time.

< Definition Name = "Classiclayout" Path = "/Layout/classic. jsp" >
< Put Name = "Header" Value = "/Header. jsp"   />
< Put Name = "Menu" Value = "/Menu/list. jsp" />
< Put Name = "Main" Value = "/Teacher/list. jsp" />
< Put Name = "Footer" Value = "/Footer. jsp"   />  
</ Definition >

Also, the value in <put> can only be. JSP, use. I can't do it. The test result is no good. Although no error is reported, the page is generated before it expires. Depressed!

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.