Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Problem with Tiles decoration and struts2

Problem with Tiles decoration and struts2

2007-11-06       - By Amit Rana

 Back
Reply:     1     2     3     4     5     6  

Hi,

I am trying to get TilesDecorationFilter
(http://tiles.apache.org/tutorial/advanced/utils.html) to work with
struts2.0.9 without any success. Can anyone please help me figure out
where am I going wrong? I am not sure if this is a tiles list question
or struts?

Tiles is decorating jsps but not the out put from an action.

If I access jsp/home.jsp it comes with the layout but home.action
only prints layout and result of action is not seen anywhere. There
are no errors. Kindly advice.

web.xml
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  id="WebApp_ID" version="2.5">
  <display-name>MyApp</display-name>

  <listener>
    <listener-class>
      org.apache.struts2.tiles.StrutsTilesListener
    </listener-class>
  </listener>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
      org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
  </filter>
  <filter>
    <filter-name>tilesdecoration</filter-name>
    <filter-class>org.apache.tiles.web.util.TilesDecorationFilter</filter-class>
    <init-param>
      <param-name>definition</param-name>
      <param-value>blank</param-value>
    </init-param>
    <init-param>
      <param-name>attribute-name</param-name>
      <param-value>body</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>tilesdecoration</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <welcome-file-list>
    <welcome-file>home.action</welcome-file>
  </welcome-file-list>
</web-app>

struts.xml
<struts>
  <package name="default" extends="struts-default">
    <result-types>
      <result-type         class="org.apache.struts2.views.tiles.TilesResult"
name="tiles">
      </result-type>
    </result-types>
    <action name="home" class="com.tj.actions.HomeAction">
      <result>jsp/home.jsp</result>
    </action>
  </package>
</struts>

tiles.xml
<?xml version="1.0" encoding="ISO-8859 (See http://ISO-8859.ora-code.com)-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
      "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
      "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>
  <definition name="blank" template="/jsp/template/blankLayout.jsp">
    <put-attribute name="title" value="my application" />
  </definition>
</tiles-definitions>

blankLayout.jsp
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<html>
   <head>
       <title><tiles:getAsString name="title"/></title>
   </head>
   <body>
       <tiles:insertAttribute name="body" />
   </body>
</html>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)