This seemed to do the trick along with creating my own
"custon_chain-config.xml"
<servlet>
....
<init-param>
<param-name>chainConfig</param-name>
<param-value>
org/apache/struts/chain/chain-config.xml,
/WEB-INF/custom-chain-config.xml
</param-value>
</init-param>
..
</servlet>
This works for defining an action via the catalog/command
<action path="/MyChainAction" catalog="mycat" command="mychain"
name="MyChainActionForm" validate="true" scope="request"
input="theinput.jsp">
<forward name="success"
path="thesuccess.jsp" />
</action>
I also had no problem getting things out of a form within a "command" eg:
public boolean execute(ActionContext context) throws Exception {
LazyValidatorForm theForm =
(LazyValidatorForm)context.getActionForm();
String somefield = (String)theForm.get("thefield");
...
context.getRequestScope().put("theresult", theresult);
return false;
}
Joe Germuska wrote:
It is unlikely that you need to use the ChainListener in a Struts
1.3.xapplication.
First, you can have the ActionServlet instantiate all of your command
catalogs by specifying the servlet init parameter "chainConfig" with a
comma-separated list of classpath or servlet resources. Remember that if
you manually provide this property, you must be sure to include the
default
Struts chain ("org/apache/struts/chain/chain-config.xml") or one which
establishes an alternate processing chain, in addition to any of your own
which are used purely for per-request custom mappings.
Once you've done that, you can use the catalog and command attributes
of an
action to cause Struts to invoke that command for a request instead
of, or
in addition to an action. (The command will be executed first if you
specify both a command and a "type".)
You can count on your commands used in an action mapping being invoked
with
a Context which is actually a subclass of ActionContext and use that to
access the request/response/mapping/form and the like which would be
passed
in to an Action's "execute" method.
Please note that I don't think a whole lot of people have been using this
feature, so you may well find bugs or even simply find that it could use
some refinements. But this is the basic overview of how it's supposed to
work.
I hope this helps.
Joe
On 1/19/07, manunixx <[EMAIL PROTECTED]> wrote:
hallo guys!
I spent a lot of time trying to retrive a catalog from a struts
action but
i
didn't get results! :(
Following the guidelines found in the jakarta commonsChain, I did this:
defining a catalog.xml <catalog>...</catalog>
adding a ChainListener to web.xml
defining a parameter org.apache.commons.chain.CONFIG_CLASS_RESOURCE to
tell
the listener where to locate the catalog.xml
trying to retrive the catalog parsed from an action by doing:
Catalog catalog = CatalogFactory.getInstance().getCatalog(); // this
return
null
Question: do I have to config a CatalogFactory before?
can anyone suggest me any reference or updated documentation regarding
struts action and common chain?
I saw that action mapping in struts-config.xml do accepts parameters
"catalog and command".
Do I have to use these to interact with commands?
Please halp me, I'm getting Nuts!
Emanuele.
--
View this message in context:
http://www.nabble.com/combining-chain-of-commands-with-struts-action-tf3039447.html#a8447680
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]