Java Mailing List Archive

http://www.junlu.com/

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

problems retriving a Catalog from a Struts Action: ChainListener get a catalog null

Emanuele

2006-12-29


Hi, I'm trying to get a Catalog from a Struts Action using ChainListener as described in the Commons Chain Cookbook at point "call a Command from Struts".

What happens is that I get a Null Catalog executing this line of code:
Struts Action:

... ...
Catalog catalog = (Catalog) request.getSession().getServletContext().getAttribute("catalog");
... ...

This is my relevant config:

web.xml:
<!-- Commons Chain listener to load catalogs -->
<context-param>
<param-name>org.apache.commons.chain.CONFIG_WEB_RESOURCE</param-name>
   <param-value>/WEB-INF/catalog.xml</param-value>
</context-param>
<listener>
<listener-class>org.apache.commons.chain.web.ChainListener</listener-class>
</listener>

Struts-config:

<action path="/testComando"
       name="testBean" scope="request" validate="false"
       type="it.prato.comune.sit.serviziweb.controller.action.CommandAction">
  <forward name="success"   path="/jsp/home.jsp" />
</action>

catalog.xml:
<catalog name="catalog">
  <command name="Comando2"       className="it.prato.comune.sit.serviziweb.controller.command.TestCmdDue" />
</catalog>

I just to be able to read my catalog from a Struts Action to get the commands executed. Any kind of suggest would be appreciate. Thanks.
__________________________________________________
Do You Yahoo!?
Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi
http://mail.yahoo.it
©2008 junlu.com - Jax Systems, LLC, U.S.A.