cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <giac...@apache.org>
Subject Re: Action ...
Date Sun, 11 Feb 2001 16:11:42 GMT
Klaus Drechsler wrote:
> Hi,
>
> I have tried to write my own action. it looks like this:
>
> ....
> public class SessionAction extends ComposerAction {
>      public void configure( Configuration configuration) throws
> ConfigurationException {}
>
>      public Map act (EntityResolver resolver, Map objectModel, String src,
> Parameters par)
>      	throws Exception {
>      	temporaryMap = new HashMap(1);
> 	temporaryMap.put(new String("validSession"),new String ("true"));
> 	System.out.println(temporaryMap.get("validSession")); // -> prints always
> "true" out
>          return temporaryMap;
>      }
> ....

Your Map contains "validSession" => "true"

>
>
> So as you can see. I return a HashMap to the Sitemap. In the sitemap I put
> the following:
>
>     <map:match pattern="sm/*">
>      <map:act set="mytest">
> 	<map:generate type="serverpages" src="abc/{1}.xsp"/>

Here you try to get at the value of {1} from the Map returned by your action. 
Unfortunately your map does not contain a member named "1". the only one you 
have is "validSession".

So, replace your {1} with {validSession} and you'll get what you excpect.

Giacomo

>      	<map:transform src="abc/sm-logicsheet.xsl"/>
>      	<map:serialize type="html"/>
>     </map:act>
>     </map:match>
>
>
> In the dos-window I always get "true" (as expected), so the Map Object is
> correct. But in the browser window
> I get the error Message:
> ....
> Can't read file:
> file:/C:/jakarta-tomcat-4.0-b1/webapps/cocoon/dbprakhouse/null.xsp
> ....
> But cocoon should load "true.xsp"!
>
> What am I doing wrong? Why is "{1}" substituted with "null"?
>
> How do I access the returned Map Object within the Sitemap?
>
> Pleas help!
>
> Thanks in advice!
>
> Bye,
>   Klaus

Mime
View raw message