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!