cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lai, Harry" <>
Subject RE: Can´t get an request from an action to org.apache.cocoon.
Date Tue, 30 Apr 2002 21:41:42 GMT
Hi Markus,

In your XSP, try using get-attribute instead of get-parameter.  If I
remember right, that was a typo in the hello world sample in the docs.  =)


-----Original Message-----
From: Markus Locher, IE-Services []
Sent: Tuesday, April 30, 2002 5:30 AM
To: Cocoon Mailinglist
Subject: Can´t get an request from an action to org.apache.cocoon.

Hello Folks,

I added a self-developed action to org/apache/cocoon with a path from there
like ask/auth. Under auth I have created a servlet called You
guessed!.. I am trying to create a login-action for internal use (I know
there is a sample, but that doesn´t fit our needs).

The Login-Servlet gives me a Map back (nothing new) and it sets an attribute
to a Request like ...


as in the docs from Cocoon!!! "Creating and Using Actions".

The value of the Map is read successfully in the sitemap.xmap, but the
request values can't be read out within an xsp-page.

What's wrong?
package org.apache.cocoon.ask.auth;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.acting.AbstractAction;
import org.apache.cocoon.Constants;
import java.util.Map;
import java.util.HashMap;
import org.apache.cocoon.environment.*;
import org.xml.sax.EntityResolver;

public class Login extends  AbstractAction
     implements  ThreadSafe {

  public Map act (Redirector   redirector,
                  SourceResolver resolver,
                  Map     objectModel,
                  String   source,
                  Parameters   params
   ) {

    Map  sitemapParams  = new HashMap();
      sitemapParams .put ("authArt", "login");

    Request  request = (Request) objectModel.get (Constants.REQUEST_OBJECT);
      request .setAttribute ("hello", "world");

   return sitemapParams;
<para><xsp-request:get-parameter name="hello"/></para>
The rest of xsp-page is correct.
 <p><xsl:value-of select="//para"/></p> <br/>
... Rest OK.
     <map:action name = "xifs-login"
        src  = "org.apache.cocoon.ask.auth.Login"/>
... within a pipeline!!!
<!-- SERVLETS -->
   <map:match pattern="auth/**">
      <!-- Performe login ... -->
      <map:act type="xifs-login">

 <map:generate type="serverpages" src="xsp/login.xsp"/>
     <map:transform src="styles/login.xsl"/>


      <!-- If all fails ...-->
      <map:redirect-to uri="../welcome"/>



Thanks for any help.

Regards Markus

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message