Structs's Tiles label Learning (i)

Source: Internet
Author: User
Tags define definition config tld

































Tiles is a template Engine that allows Web page configuration (Layout) tags to be separated from content, and a layout management mechanism is proposed.















The most common way to work with pages on a Web page is a table, by setting the table border to 0, you can use it to cut the layout and place the content in it, however, a lot of layout of the label will be mixed with the content (individuals do not like to deal with the label of the table: (), if you want to change the content or layout configuration, it will be a problem.

In the design of the Windows program there is a layout manager (Layout Manager) mechanism, we can choose a layout management mechanism, and then directly in the window container to add components instead of processing layout details, and by the layout manager to deal with the layout of components, if you want to change the layout configuration, If you change the layout manager directly, all components will automatically reconfigure the layout according to the new administrator.


Tiles provides a mechanism similar to the Windows Program layout management, by defining files, you can define the layout, and the content pages that you want to place, the content and layout tags can be separated, you can swap each content page at any time, you can reuse each layout.


Tiles provides a mechanism similar to the Windows Program layout management, by defining files, you can define the layout, and the content pages that you want to place, the content and layout tags can be separated, you can swap each content page at any time, you can reuse each layout.


In struts 1.1, tiles with it, you can start directly from the Struts-blank, which has included tiles necessary files and settings, if you want to set tiles, you must have Commons-beanutils.jar , Commons-logging.jar, Commons-collections.jar, Commons-digester.jar, Struts.jar four files in your Web-inf/lib directory,


In struts 1.1, tiles with it, you can start directly from the Struts-blank, which has included tiles necessary files and settings, if you want to set tiles, you must have Commons-beanutils.jar , Commons-logging.jar, Commons-collections.jar, Commons-digester.jar, Struts.jar four files in your Web-inf/lib directory,

First: and add the following content to the Struts-config.xml:











<plug-in classname= "Org.apache.struts.tiles.TilesPlugin" >











<set-property property= "Definitions-config"











Value= "/web-inf/conf/tiles-defs.xml"/>











<set-property property= "Moduleaware" value= "true"/>











<set-property property= "Definitions-parser-validate" value= "true"/>











</plug-in>



In Struts 1.1, you can hang up on tiles without defining your actionservlet as long as you use plugin. The Tiles-defs.xml in the Definitions-config property is the tiles definition file, Tiles provides a requestprocessor for processing requests, and can perform additional actions forward and include, in Struts-config The default in. xml is to use it:

Code:

<controller

processorclass= "Org.apache.struts.tiles.TilesRequestProcessor"/>


These two positions in the Struts-config.xml, you can refer to the Struts-blank in the setting;


These two positions in the Struts-config.xml, you can refer to the Struts-blank in the setting;

Finally, you want to place the STRUTS-TILES.TLD under WEB-INF/TLD and define it in web.xml so that you can use the tiles tag, for example in Web.xml:











Code:

<taglib>

<taglib-uri>/tags/struts-tiles</taglib-uri>

<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>

</taglib>


When you're done, you can use the tiles feature, and tiles's definition files can be done using XML or JSP pages, which will be explained later in the topic. There will be time to give you the following topic.


When you're done, you can use the tiles feature, and tiles's definition files can be done using XML or JSP pages, which will be explained later in the topic. There will be time to give you the following topic.


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.