• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2: Alternative to tiles?

 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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.
 
Arun Christopher
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try

<jsp:include page="example.jsp" />
[ December 02, 2008: Message edited by: Arun Christopher ]
 
Ryan Peterson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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/
 
Subrata Biswas
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic