You can view the tutorials best in Google Chrome, Mozilla Firefox, Opera, higher version of Internet Explorer

Working With Struts 2 Tiles, Struts 2 Tiles Example

Struts » On Oct 29, 2011 By Sivateja

let us see how to work with tiles frame work in struts 2, tiles is the real time concept every body must know.  Actually tiles applications is little different than other applications we worked up to now, let us see what are the changes need to do before going to the application.

  • We must create tiles.xml to configure the pages, and this tiles.xml file must be in web-inf  folder only just like web.xml
  • In the web.xml file add the following code

Following jars file need to be added in lib folder of our web application, in order to work with this tiles framework in struts 2

  • commons-beanutils-1.7.0.jar
  • commons-collections-3.1.jar
  • commons-digester-2.0.jar
  • commons-fileupload-1.2.1.jar
  • commons-io-1.3.2.jar
  • commons-lang-2.3.jar
  • commons-logging-1.1.jar
  • freemarker-2.3.13.jar
  • struts2-convention-plugin-2.1.6.jar
  • struts2-core-2.1.6.jar
  • struts2-tiles-plugin-2.2.1.jar
  • tiles-api-2.0.6.jar
  • tiles-core-2.0.6.jar
  • tiles-jsp-2.0.6.jar
  • xwork-2.1.2.jar
  • ognl-2.6.11.jar


Files required….

  • index.jsp
  • body.jsp
  • footer.jsp
  • head.jsp
  • baseLayout.jsp
  • page1.jsp
  • page2.jsp
  • web.xml
  • tiles.xml
  • struts.xml

Directory Structure














By ( Java/J2EE Developer & Web Designer )
Founder of You can contact me at sivateja [at]


10 Responses to “Working With Struts 2 Tiles, Struts 2 Tiles Example”
  1. Twinkle Stardust says:

    its throwing an error :

    type Status report

    message There is no Action mapped for namespace / and action name welcomeLink.

    description The requested resource (There is no Action mapped for namespace / and action name welcomeLink.) is not available.

  2. Java4s says:

    @ Twinkle

    Yeah you almost reached :-)
    Even i faced thisproblem initially, do one thing, try to change welcomeLink to some thing else.
    so you need to do the changes in, struts.xml, tiles.xml too hope you know this.

    Hey do it carefully and slowly if you are fresher i will help you.

  3. Eduardo says:

    I have a question.
    about this example, if only i need refresh page1 without refresh others, how can I do this?.


  4. Java4s says:

    @ Eduardo

    Like gmail ? :-)
    Then you need to use Json,Ajax Calls.

  5. deepak says:

    anyone tell me how to use persistence in struts tiles … give a demo also plzzzzzzzzzz

  6. Hi!
    The above project ended up with the following error when I run on the tomcat server. Could you please help me ………..

    HTTP Status 404 – /MySpringDemo/index.jsp
    type Status report
    message /MySpringDemo/index.jsp
    description The requested resource (/MySpringDemo/index.jsp) is not available.Apache Tomcat/7.0.29

  7. pppppp`pp` says:

    wow wonderfull and thnx

  8. Attribute “class” is required and must be specified for element type “result-type”.

    like giving error in

  9. tanveer Ahmad says:

    can we prevent the header and footer jsp to refresh again and again for each action,instead refresh only body jsp for its corresponding action and keep header and footer static.
    thanks in advance

  10. Ajay kumar says:

    Hi please send me struts2+tiles+hibernate3 complete example


By posting your answer, you agree to our comments policy.
So, What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs

Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links
Current & UpComing Tutorials
Sitemap :
spring Hibernate struts Json Ajax Log4j Log4j coreJava Servlets Web Services

  Web Services [ SOAP ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
© 2010 - 2015 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.