This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Struts2: Alternative to tiles?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently I am using tiles for my project, but I am starting to get annoyed about having to deal with an additional configuration in the form of the tiles file. Are there better alternatives to tiles for cases where I want to be able to share a common look across my web site?

I am using Struts 2.0.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try

<jsp:include page="example.jsp" />
[ December 02, 2008: Message edited by: Arun Christopher ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been using Sitemesh with acceptable results. It might be worth giving a try: http://www.opensymphony.com/sitemesh/
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you can do it very well. here two sample file for the same it may help you-
======================================
JSP file that define my Template
======================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-help.tld" prefix="help" %>
<%@ page import="java.text.DateFormat,java.text.SimpleDateFormat" %>

<html>
<head>
<layout:skin includeScript="true"/>
<title>Tab/Wizard Demo</title>

</head>

<body>
<center>
<tiles:get name="header"/>
</center>
<table border="0" style="background-color:FFFFFF" cellspacing="0" cellpadding="10" width = "80%" align="center">
<tr>
<td>
<tiles:get name="crumb"/>
</td>
</tr>
</table>
<table border="0" style="background-color:FCF7D9" cellspacing="0" cellpadding="10" width = "80%" align="center">
<tr>
<td>
<tiles:get name="body"/>
<td>
</tr>
</table>
<center>
<tiles:get name="footer"/>
</center>
</body>
</html>
==============================================
My JSP File which is using the above template
==============================================
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert template="template.jsp">
<tiles ut name="header" content="header.jsp" />
<tiles ut name="crumb" content="bredcrumb.jsp"/>
<tiles ut name="body" content="/mybody/employee.jsp" />
<tiles ut name="footer" content="footer.jsp" />
</tiles:insert>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic