Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts2 and Tiles2 - Error executing tag: Attribute 'title' not found.

807580Aug 23 2010 — edited Sep 3 2010
I keep getting Error executing tag: Attribute 'title' not found when I go to the baseLayout.jsp page. I am figuring it is not seeing the tiles.xml file, but I have placed it in the /WEB-INF directory like every web page I have found says too. Any help or pointers would be appreciated.
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Error executing tag: Attribute 'title' not found.
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
I am using maven to load my dependency, so here are the version numbers.
        <dependency>
		<groupId>org.apache.struts</groupId>
		<artifactId>struts2-core</artifactId>
		<version>2.2.1</version>
	</dependency>

	<dependency>
		<groupId>org.apache.struts</groupId>
		<artifactId>struts2-tiles-plugin</artifactId>
		<version>2.2.1</version>
	</dependency>

        <dependency>
		<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>1.2.16</version>
	</dependency>

        <dependency>
		<groupId>jboss</groupId>
		<artifactId>javassist</artifactId>
		<version>3.1</version>
	</dependency>
Struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

	<constant name="struts.enable.DynamicMethodInvocation"
		value="false" />
	<constant name="struts.devMode" value="false" />
	<constant name="struts.custom.i18n.resources"
		value="forum" />

	<package name="default" namespace="/" extends="struts-default">

		<result-types>
			<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
		</result-types>
		<action name="login" class="net.game_tech.LoginAction">
			<result name="success" type="tiles">/login.success.tiles</result>
			<result name="error" type="tiles">/login.tiles</result>
		</action>
		<action name="login-form">
			<result name="success" type="tiles">/login.tiles</result>
		</action>

	</package>

</struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>Forum</display-name>
	<listener>
		<listener-class>
			org.apache.struts2.tiles.StrutsTilesListener
		</listener-class>
	</listener>
	<context-param>
		<param-name>tilesDefinitions</param-name>
		<param-value>/WEB-INF/tiles.xml</param-value>
	</context-param>

	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>
			org.apache.struts2.dispatcher.FilterDispatcher
		</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
  
	<resource-ref>
		<description>Mysql Forum</description>
		<res-ref-name>jdbc/Forum</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
		<res-sharing-scope>Shareable</res-sharing-scope>
	</resource-ref>
  
</web-app>
tiles.xml
<?xml version="1.0" encoding="UTF-8" ?>

<!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="baseLayout" template="/baseLayout.jsp">
		<put-attribute name="title" value="Simple Java Forums" />
		<put-attribute name="header" value="/common/Header.jsp" />
		<put-attribute name="menu" value="/common/MenuNav.jsp" />
		<put-attribute name="body" value="" />
		<put-attribute name="footer" value="/common/Footer.jsp" />
	</definition>
	
	<definition name="/login.tiles" extends="baseLayout">
		<put-attribute name="header" value="/pvt/Login.jsp" />
	</definition>
	
	<definition name="/login.success.tiles" extends="baseLayout">
		<put-attribute name="header" value="/pvt/Welcome.jsp" />
	</definition>
	
</tiles-definitions>
baseLayout.jsp
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title><tiles:insertAttribute name="title" /></title>
	<link href="css/main.css" rel="stylesheet" type="text/css" media="all"/>
</head>
<body>
	<div id="page">
		<tiles:insertAttribute name="header" />
		<tiles:insertAttribute name="menu" />
		<tiles:insertAttribute name="body" />
		<tiles:insertAttribute name="footer" />
	</div>
</body>
</html>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2010
Added on Aug 23 2010
3 comments
2,807 views