Hi, I am trying to implement the following simple action: - The URL ...cocoon/learn/hello?language=english should invoke an action called HelloWorldAction. - HelloWorldAction plugs in the a new parameter "greeting", whose value is the word for 'Hello' in the language specified. - Upon success, the user is redirected to ...cocoon/xsp/helloWorld.xsp. - helloWorld.xsp will print out something like 'The english greet you with a hello'.
The trouble is, the actions *seems* to get invoked (the success branch redirect is
happening), but
- none of the log statements get printed (I am looking at core.log)
- the parameters langauge and greet are not passed on to helloWorld.xsp.
Here are my sources:
1. Sitemap:
<map:components>
...
<map:actions>
<map:action name="hello-action" src="learn.HelloWorldAction"/>
</map:actions>
</map:components>
...
<map:match pattern="hello*">
<map:act type="hello-action">
<map:parameter name="parameters" value="true"/>
<map:parameter name="language" value="{language}"/>
<map:redirect-to
uri="xsp/helloWorld.xsp?language={language}&greeting={greeting}"/>
</map:act>
<map:redirect-to uri="index.html"/>
</map:match>
2. act method in HelloWorldAction.java
public Map act (Redirector redirector,
SourceResolver resolver,
Map objectModel,
String source,
Parameters par) {
String language = par.getParameter("language", "English");
this.getLogger().fatalError("************* GET LANGUAGE = " + language);
String greet = null;
if (language == null || language.equalsIgnoreCase("")) {
language = "Tamil";
greet = "vaNakkaM";
} else {
if (language.equalsIgnoreCase("ENGLISH")) {
greet = "Hello";
}
if (language.equalsIgnoreCase("TELUGU")) {
greet = "giDigiDi";
}
if (language.equalsIgnoreCase("HINDI")) {
greet = "Namaste";
}
}
this.getLogger().fatalError("************* SET LANGUAGE = " + language);
this.getLogger().fatalError("************* SET GREETING = " + greet);
Map map = new HashMap(1);
map.put("greeting", greet);
return map;
}
3. helloWorld.xsp (I know this is fine, I can invoke it directly with the parameters
and it shows up correctly)
<?xml version="1.0" encoding="UTF-8"?>
<xsp:page xmlns:xsp="http://apache.org/xsp"
xmlns:request="http://apache.org/xsp/request/2.0">
<page>
<title>Language Primer</title>
<content>
<para>
The <xsp:expr>request.getParameter("language")</xsp:expr> greet you with a
<xsp:expr>request.getParameter("greeting")</xsp:expr>.
</para>
</content>
</page>
</xsp:page>
What am I doing wrong?
Thanks for any and all help,
Sreedhar
<<winmail.dat>>
--------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>
