Hi,

I am getting the following issues with Tiles + Struts 2 : Please help

***************************************************************************************
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at
org.apache.struts.taglib.tiles.InsertTag.processAttribute(InsertTag.java:687)
at
org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:478)
at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:438)

     Struts has detected an unhandled exception:
  *Messages*:

   1. ServletException including path '/WEB-INF/jsp/homepage.jsp'.
   2. ServletException including path '/WEB-INF/jsp/homepage.jsp'.

  *File*: org/apache/struts/taglib/tiles/InsertTag.java  *Line number*: 687
 ------------------------------
Stacktraces
*org.apache.tiles.TilesException: ServletException including path
'/WEB-INF/jsp/homepage.jsp'.*

    
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:614)
    
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)

***********************************************************************

*petStoreTilesConfigFile.xml*

<?xml version="1.0" encoding="ISO-8859-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="homePage" template="/WEB-INF/jsp/homepage.jsp">
<put-attribute name="header" value="/WEB-INF/jsp/IncludeTop.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
<put-attribute name="body" value="/WEB-INF/jsp/index.jsp" />
<put-attribute name="banner" value="/WEB-INF/jsp/IncludeBanner.jsp" />
<put-attribute name="footer" value="/WEB-INF/jsp/IncludeBottom.jsp" />
    </definition>
</tiles-definitions>

*********************************************************************

*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>NewPetstore</display-name>
        <!-- - Key of the system property that should specify the root directory
                of this - web app. Applied by WebAppRootListener or 
Log4jConfigListener. -->
        <context-param>
                <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
                
<param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
                
<param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
                <param-value>/WEB-INF/petStoreTilesConfigFile.xml</param-value>
        </context-param>

<!-- - Key of the system property that should specify the root directory
                of this - web app. Applied by WebAppRootListener or 
Log4jConfigListener. -->
        <context-param>
                <param-name>webAppRootKey</param-name>
                <param-value>petstore.root</param-value>
        </context-param>

        <!-- - Location of the Log4J config file, for initialization and refresh
                checks. - Applied by Log4jConfigListener. -->
        <context-param>
                <param-name>log4jConfigLocation</param-name>
                <param-value>/WEB-INF/log4j.properties</param-value>
        </context-param>

        <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/dataAccessContext-local.xml
/WEB-INF/applicationContext.xml</param-value>
                <!-- <param-value>/WEB-INF/dataAccessContext-jta.xml
/WEB-INF/applicationContext.xml</param-value> -->
        </context-param>

        <context-param>
                
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
                <param-value>/WEB-INF/petStoreTilesConfigFile.xml</param-value>
        </context-param>
        <filter>
                <filter-name>struts</filter-name>
                
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>

        <filter-mapping>
                <filter-name>struts</filter-name>
                <url-pattern>*.action</url-pattern>
        </filter-mapping>

        

        <listener>
                
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>


        <listener>
                
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
        </listener>

        <listener>
                <!-- 
<listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
-->
                
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
        </listener>

        <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                <welcome-file>default.html</welcome-file>
                <welcome-file>default.htm</welcome-file>
                <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
</web-app>
*

*********************************************************************

*homepage.jsp*

*<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<%@ taglib uri="http://struts.apache.org/tags-tiles"; prefix="tiles"%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home Page : Pet Store</title>
</head>

<body>
<tiles:insert attribute="header" />
<tiles:insert attribute="menu" />
<tiles:insert attribute="body" />
<tiles:insert attribute="banner" />
<tiles:insert attribute="footer" />
</body>
</html>*

*Regards,*
*Srineel*

Reply via email to