Struts 2.x Tiles Framework
In this post we are going to see the Struts 2.x Tiles Framework, Plugins integration and Use.
Struts 2.x Tiles framework help us to make effective and easy way to maintain websites. With the use of tiles in developing web projects i.e. Struts 2.x Projects, We are able to make and deliver changes in a particular area of page on user’s click without any need to copy paste or write entire code on all the pages. Just what we need is to integrate our project with tiles framework.
If the above paragraph is making some confusions. Lets move on to have a look at the plugin requirements to have Tiles Framework support in our Struts 2.x Web Project.
Here are some plugins which should be present in our lib folder or directory in order to have Struts 2.x Tiles Framework support:
1. commons-beanutils-1.7.0.jar 2. commons-digester-2.0.jar 3. commons-fileupload-1.2.2.jar 4. commons-io-2.0.1.jar 5. commons-lang-2.5.jar 6. commons-logging-api-1.1.jar 7. freemarker-2.3.16.jar 8. javassist-3.11.0.GA.jar 9. ognl-3.0.1.jar 10. struts2-core-2.2.3.jar 11. struts2-tiles-plugin-2.2.3.jar 12. tiles-api-2.0.6.jar 13. tiles-core-2.0.6.jar 14. tiles-jsp-2.0.6.jar 15. xwork-core-2.2.3.jar
Make the following changes in web.xml file:
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG /WEB-INF/tiles.xml org.apache.struts2.tiles.StrutsTilesListener
Now, make a tiles.xml file in the WEB-INF directory and write the following code there: