cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mats Norén <mats.no...@spectral.se>
Subject Sitemap + Action + AbstractSitemap
Date Wed, 24 Jan 2001 09:58:52 GMT
Hi,
I've been trying a couple of times to pass values from an Action back to the
sitemap.
I´ve written a simple dummy class called LoginAction which works like a
selector in many ways.

 public Map act (EntityResolver resolver, Map objectModel, String src,
Parameters par) throws Exception {
 HttpServletRequest req = (HttpServletRequest)
objectModel.get(Constants.REQUEST_OBJECT);
 String name = req.getRemoteUser();
 String uri = "";
 if (name != null)
     {
          uri = par.getParameter("logged_in", "");
          System.out.println("User " + name + " logged in..URI set to: " +
uri);
     }
 else
     {
          uri = par.getParameter("not_logged_in", "");
          System.out.println("User " + name + " not logged in..URI set to: " +
uri);
     }
     Map tmp = new HashMap(1);
     System.out.println(uri);
     tmp.put("uri", uri);
     return tmp;
}

I thought that it returned a java Map back to the sitemap and that it could be
retreived by something like (Giacomos example):

<map:match pattern="subscribe/login.html">
    <map:act type="login">
    <parameter name="logged_in" value="forms.xml"/>
    <parameter name="not_logged_in" value="welcome.xml"/>
        <map:generate src="{uri}"/>
    </map:act>
</map:match>

I looked in the substitute function of AbstractSitemap and found that the List
in my particular case (above) is empty.
I also looked at the generated code for the sitemap, and for the life of me, I
can´t see what goes wrong.





Mime
View raw message