I. How to Use the tiles framework
1. Add a jar package. Struts has been integrated.
2. Configure the plus-In attribute in Struts-config
3. Configure the taglib attribute in Web. xml and configure the tiles tag.
4. Write tiles profile tiles-def.xml
5. According to the tiles-def.xml write layout, the layout is actually a. jsp, but contains the tiles: insert
6. Write the page
7. Different jump methods: 1) Add a new page (Two JSPs are required for each page, one calling page and one page in the Framework)
2) use the paremeter attribute of action.
2. Notes for using the tiles framework:
1. The definitions-config attribute in the plus-In attribute specifies the tiles configuration file. You can specify multiple
2. combination in the tiles configuration file
<Definition name = "base-definition" Path = "/layout. jsp">
<Put name = "sidebar" value = "sidebar. jsp"/>
<Put name = "Header" value = "header. jsp"/>
<Put name = "content" value = ""/>
<Put name = "footer" value = "footer. jsp"/>
</Definition>
<Definition name = "index-definition" extends = "base-definition">
<Put name = "content" value = "indexcontent. jsp"/>
</Definition>
In this way, each time you add a new page similar to indexcontent, you only need to configure a new definition inherited from base-definition.
3. The main page and the content page in the layout are different concepts. The main page only needs to have such a few words.
<% @ Page contenttype = "text/html; charset = gb2312" %>
<% @ Taglib uri = "http://jakarta.apache.org/struts/tags-tiles" prefix = "tiles" %>
<Tiles: insert definition = "index-definition"/>
The definition attribute specifies the configuration in tiles to be used.
The content page can be written without considering the template.
4. The two different usage methods are not clear yet. However, tiles is really useful.
Iv. Advantages and disadvantages of the frame structure currently used by tiles and departments:
To be honest, compared with the use of the framework structure, it is still troublesome, and it will increase the number of JSP. However, the Department's frame framework is actually quite fragile. If you directly enter a URL in the address bar, the framework will no longer exist. This is very dangerous. Tiles makes up for this deficiency.
Check whether two things can be used together.