Hi,
I've looked in the docs and in the archives but I can't find out
why I'm having trouble with actions in Cocoon 2.0 (binary
version). Here's what I did:
1. I created a HelloPoohAction.java, almost identical to the one
in the "Creating and using actions" docs, except that I added
import statements for Redirector and SourceResolver, and the
act() method contains:
Map sitemapParams = new HashMap();
sitemapParams.put("mySiteParamValue", "Eeyore");
Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
request.setAttribute("myname", "Tigger");
return sitemapParams;
2. I compiled this file and placed the class file into a
sub-directory of WEB-INF/classes (to match the package).
3. I stopped Tomcat (4.0.1), and removed Cocoon's work directory
(just in case anything was cached).
4. At the top of my sitemap, I have in the <map:actions> section:
<map:action name="hello-pooh"
src="com.newhomesdirect.web.HelloPoohAction"/>
and my <match> section looks like this:
<map:match pattern="xsp/*">
<map:act type="hello-pooh">
<map:generate type="serverpages" src="docs/samples/xsp/{1}.xsp"/>
<map:transform src="stylesheets/dynamic-page2html.xsl">
<map:parameter name="view-source"
value="docs/samples/xsp/{1}.xsp"/>
</map:transform>
</map:act>
<map:serialize/>
</map:match>
5. I started Tomcat and pulled up the Cocoon welcome page. No
problem here. I checked the logs and I have:
DEBUG (2002-02-07) 14:58.41:890 [cocoon ] (/cocoon/welcome)
HttpProcessor[8080][1]/ExcaliburComponentSelector: Adding
com.newhomesdirect.web.HelloPoohAction for hello-pooh
so I see it found my class.
6. In a web browser, I do a request for /cocoon/xsp/simple and
get a Resource Not Found error. Again, I check the logs, and
this time I see that it instantiated my class all right, and I
even see the parameter values:
DEBUG (2002-02-07) 15:01.07:982 [cocoon ]
(/cocoon/xsp/simple) HttpProcessor[8080][1]/sitemap_xmap: Action
hello-pooh
DEBUG (2002-02-07) 15:01.07:983 [cocoon ]
(/cocoon/xsp/simple) HttpProcessor[8080][1]/AbstractSitemap:
Current Sitemap Parameters:
PARAM: 'mySiteParamValue' VALUE: 'Eeyore'
PARAM: '../1' VALUE: 'simple'
PARAM: '../0' VALUE: 'xsp/simple'
but right after that, I see:
DEBUG (2002-02-07) 15:01.07:983 [cocoon ]
(/cocoon/xsp/simple) HttpProcessor[8080][1]/sitemap_xmap:
Source=docs/samples/xsp/{1}.xsp
WARN (2002-02-07) 15:01.07:984 [cocoon ]
(/cocoon/xsp/simple) HttpProcessor[8080][1]/AbstractSitemap:
Substitute: value not found for 1 while evaluating
docs/samples/xsp/{1}.xsp
...snip...
DEBUG (2002-02-07) 15:01.07:989 [cocoon ]
(/cocoon/xsp/simple) HttpProcessor[8080][1]/URLFactoryImpl:
Making URL from
file:/web/tomcat/webapps/cocoon/docs/samples/xsp/.xsp
Which explains the error on the web browser. But why does the
parameter "1" just disappear like that?
If this is documented somewhere please throw me a URL; if not,
does anyone have any suggestions?
Thanks in advance!
Andre.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>