Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Can SomeOne Help?? NullPointerException in TilesException using Tiles with Struts 2

Avinash Wable

2007-03-08

Replies:

I already posted this in "NullPointerException in TilesException using Tiles
with Struts 2" thread.

Does anyone got the same problem when using Tiles 2 with Struts 2

My jsps are simple (don't use tiles tags). I am using tiles just as a
forward result type.

You can look at my configuration given below
1. tiles.xml-------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE tiles-definitions PUBLIC
    "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
    "http://jakarta.apache.org/struts/dtds/tiles-config_2_0.dtd">

<tiles-definitions>
 <definition name="login.page" path="/login/Login.jsp"/>
 <definition name="home.page" path="/login/Home.jsp"/>
</tiles-definitions>

2. strus.xml-------------------------------------------------------------
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
  <package name="login" namespace="/login" extends="tiles-default">
    <action name="Welcome" class="login.ShowLogin">
       <result name="showLogin" type="tiles">login.page</result>
    </action>
    <action name="Login" class="login.Login">
       <result type="tiles">home.page</result>
       <result name="invalidLogin" type="tiles">login.page</result>
    </action>
  </package>
</struts>

3. Login.jsp-------------------------------------------------------------
<%@(protected)" %>

<html>
 <head>
   <title>Login</title>
 </head>
 
 <body>
   <s:form action="Login">
     <s:textfield label="User Name" name="username"/>
     <s:password label="Password" name="password" />
     <s:submit/>
   </s:form>
 </body>
</html>

4. Home.jsp-------------------------------------------------------------
<%@(protected)" %>

<html>
<head>
 <title>Welcome</title>
 <link href="<s:url value='/css/tutorial.css'/>" rel="stylesheet"
type="text/css"/>
</head>

<body>
 <h3>Languages</h3>
 <ul>
    <li>
      <s:url id="url" action="HelloWorld">
         <s:param name="request_locale">en</s:param>
      </s:url>
      <s:a href="%{url}">English</s:a>
    </li>
    <li>
      <s:url id="url" action="HelloWorld">
         <s:param name="request_locale">es</s:param>
      </s:url>
      <s:a href="%{url}">Espanol</s:a>
    </li>
 </ul>
</body>
</html>

5. web.xml---------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

  <display-name>Sample Struts2 Application</display-name>
  <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>
 <context-param>
   <param-name>org.apache.tiles.DEFINITION_CONFIG</param-name>
   <param-value>\WEB-INF\tiles.xml</param-value>
 </context-param>
 <listener>
 
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class
>
 </listener>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

I get following error when I access this application
http://localhost:8080/SampleStruts2/login/Welcome.action


20:11:40,827 ERROR [BasicTilesContainer] Error rendering tile
java.lang.NullPointerException
    at
org.apache.struts2.tiles.StrutsTilesRequestContext.include(StrutsTilesReques
tContext.java:94)
    at
org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesReque
stContext.java:83)
    at
org.apache.tiles.impl.BasicTilesContainer.render (BasicTilesContainer.java:39
5)
    at
org.apache.tiles.impl.BasicTilesContainer.render (BasicTilesContainer.java:34
5)
    at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)
    at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSuppor
t.java:178)
.............and much more................


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

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

©2008 junlu.com - Jax Systems, LLC, U.S.A.