Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Struts2: Alternative to tiles? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2: Alternative to tiles?" Watch "Struts2: Alternative to tiles?" New topic
Author

Struts2: Alternative to tiles?

André-John Mas
Ranch Hand

Joined: Oct 18, 2008
Posts: 37
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

Joined: Nov 18, 2008
Posts: 19
You can try

<jsp:include page="example.jsp" />
[ December 02, 2008: Message edited by: Arun Christopher ]
Ryan Peterson
Greenhorn

Joined: Nov 24, 2008
Posts: 5
I have been using Sitemesh with acceptable results. It might be worth giving a try: http://www.opensymphony.com/sitemesh/
Subrata Biswas
Greenhorn

Joined: Nov 25, 2008
Posts: 9
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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2: Alternative to tiles?