File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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

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

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

Joined: Nov 24, 2008
Posts: 5
I have been using Sitemesh with acceptable results. It might be worth giving a try:
Subrata Biswas

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" %>

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


<tiles:get name="header"/>
<table border="0" style="background-color:FFFFFF" cellspacing="0" cellpadding="10" width = "80%" align="center">
<tiles:get name="crumb"/>
<table border="0" style="background-color:FCF7D9" cellspacing="0" cellpadding="10" width = "80%" align="center">
<tiles:get name="body"/>
<tiles:get name="footer"/>
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" />
I agree. Here's the link:
subject: Struts2: Alternative to tiles?
It's not a secret anymore!