struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarnot Voytek Contr AU HQ/SC <Voytek.Jar...@MAXWELL.AF.MIL>
Subject RE: [tiles] More help with tabbed tiles
Date Mon, 25 Nov 2002 20:16:51 GMT
I also have these lines in my struts-config.xml, and am using tiles-defs.xml
successfully:
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
  <set-property property="definitions-config"
value="/WEB-INF/conf/tiles-defs.xml"/>
</plug-in>

-----Original Message-----
From: Wendy Smoak [mailto:Wendy.Smoak@asu.edu]
Sent: Monday, November 25, 2002 2:11 PM
To: 'Struts Users Mailing List'
Subject: [tiles] More help with tabbed tiles



On Cedric's advice, I decided to try the xml config file approach for tiles.
I've got classicLayout and vboxLayout working, and now I'm trying to get a
tabbed page to work.

Currently, I'm getting:
javax.servlet.ServletException: Can't get definitions factory from context.

Google turned up a post that said I ought to have 'ActionComponentServlet'
defined in web.xml but that is not how the tiles-definitions example is set
up.  The message is from August 2001 so I assume that advice is no longer
valid.

My web.xml, less the filters and security stuff:

<web-app>
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>definitions-config</param-name>
      <param-value>/WEB-INF/tiles-defs.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>


  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  
</web-app>

The relevant bits of struts-config for 'testAction.do':

<struts-config>

  <action-mappings>
    <action    path="/testAction"
               type="edu.asu.vpia.example.TestAction"
               scope="request" >
      <forward name="success"
path="/WEB-INF/jsp/tilesTest/tabsTest.jsp" />               
    </action>
  </action-mappings>
  
  <message-resources parameter="ApplicationResources"/>

</struts-config>

tabsTest.jsp merely has:
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/tld/struts-tiles.tld" prefix="tiles" %>

<tiles:insert definition="examples.tabs.page" flush="true" />

And what the heck, this is already really long, so here's tiles-defs.xml:
<tiles-definitions>

  <!-- Master layout and default tiles used by all pages -->
  <definition name="examples.masterPage"
path="/WEB-INF/tilesTest/classicLayout.jsp">
	  <put name="title"  value="Tiles 1.1 Examples" />
	  <put name="header" value="/WEB-INF/tilesTest/header.jsp" />
	  <put name="menu"   value="/WEB-INF/tilesTest/menu.jsp" />
	  <put name="footer" value="/WEB-INF/tilesTest/footer.jsp" />
	  <put name="body"   value="/WEB-INF/tilesTest/body.jsp" />
  </definition>

  <!-- tabs page -->
  <definition name="examples.tabs.page" extends="examples.masterPage">
	  <put name="title"  value="Tiles 1.1 Tabs layout example" />
	  <put name="body"   value="examples.tabs.body" />
  </definition>

 <!-- body using tabs -->
  <definition name="examples.tabs.body"
path="/WEB-INF/tilesTest/tabsLayout.jsp" >
	<put name="selectedIndex"  value="0" />
	<put name="parameterName"  value="selected" />
    <putList name="tabList" >
      <item value="Doc Home"		   link="/WEB-INF/tilesTest/a.jsp"
/>
      <item value="Quick overview"	   link="/WEB-INF/tilesTest/b.jsp"
/>
    </putList>
  </definition>

</tiles-definitions>

As you can see, I've stolen most of this from tiles-docutmentation webapp.
Obviously I missed one or more things, becasue that webapp works and mine
doesn't!

Hopefully someone who has done this before will immediately see what I've
missed. :)

Thanks!

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message