Thank you Chris!

As far as I know the Struts-Tiles plugin supplied with Struts 2.1.8.1 does
not support Tiles 2.2 (or 2.1 for that matter).

This is exactly the reason!

I think both struts2 & Tiles2' official websites should highlight this in a very prominent position!

Lowered the version to tiles2.0.7, everything is fine.

What a wasting of time of all my debugging!!! I hope everything will knows about it in advance and no need to debug anymore !


--
Lu Ying






Good afternoon,

Tiles2.2.1, Struts 2.1.8.1, Spring 2.5.6, tried simple example, but always
got the following error:
===================================
java.lang.NullPointerException

  
org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:102)

org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:364)

org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:618)

org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
... ...

Could someone tell me why I get this error?

Thanks a lot!
--
Lu Ying

(1) 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>Struts2 Testing</display-name>

   <!-- Uncomment/comment this if you need/don't need Spring support -->
   <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContext*.xml</param-value>
   </context-param>


   <!-- tiles begin -->
   <context-param>
      <param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
      <param-value>/WEB-INF/tiles.xml</param-value>
   </context-param>

   <!-- tiles end -->



   <filter>
      <filter-name>struts2</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
      <init-param>
         <param-name>actionPackages</param-name>
         <param-value>user.actions</param-value>
      </init-param>
   </filter>


   <filter-mapping>
      <filter-name>struts2</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>


   <listener>

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

   </listener>
   <listener>
      <listener-class>org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
   </listener>


   <welcome-file-list>
      <welcome-file>begin.jsp</welcome-file>
   </welcome-file-list>


</web-app>





(2) struts.xml
... ...
<struts>
  <constant name="struts.enable.DynamicMethodInvocation" value="false" />
  <constant name="struts.devMode" value="false" />

<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>

<action name="*Link" method="{1}"
class="example.action.tiles.ProcessTile1">
  <result name="welcome" type="tiles">welcome</result>
  </action>
</package>

</struts>



(3) tiles.xml
<tiles-definitions>
   <definition name="baseLayout" template="/baseLayout.jsp">
   </definition>
   <definition name="welcome" extends="baseLayout">
   </definition>
</tiles-definitions>



(4) jsp file
<a href="<s:url action="welcomeLink"/>">  Tile example1</a>

(5) baseLayout.jsp
hello world

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to