cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reinhard Poetz" <reinh...@apache.org>
Subject RE: JXTemplate and Woody
Date Tue, 25 Nov 2003 08:40:50 GMT


> -----Original Message-----
> From: Brian McCallister [mailto:mccallister@forthillcompany.com] 
> Sent: Monday, November 24, 2003 11:23 PM
> To: users@cocoon.apache.org
> Subject: JXTemplate and Woody
> 
> 
> I am trying to do a fairly simple (I think) thing in Cocoon 
> (2.1.3) via  
> FlowScript -- put an object in the HttpSession and make it 
> available to  
> JXTemplate.
> 
> The FlowScript looks like:
> 
> cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/ 
> woody2.js");
> 
> function login()
> {
>      var form = new Form("forms/login.xml");
>      var employee = null;
>      var service = new  
> Packages.com.forthillcompany.infra.serv.SecurityService();
> 
>      while (employee == null)
>      {
>          form.showForm("login");
>          employee = service.login(form.getModel().name,  
> form.getModel().password);
>          cocoon.session.setAttribute("user", employee);
>      }
>      cocoon.sendPage("home");
> }
> 
> And the flow of control works correctly. It passes to a JXTemplate,  
> this form displays correctly:
> 
> <html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>      <head>
>          <title>Home</title>
>      </head>
>      <body>
>          <i18n:text>greeting</i18n:text>,  
> ${session.getAttribute("user").getDisplayName()}
>      </body>
> </html>
> 
> however the more natural form:
> 
> <html xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>      <head>
>          <title>Home</title>
>      </head>
>      <body>
>          <i18n:text>greeting</i18n:text>, ${session.user.displayName}
>      </body>
> </html>
> 
> Does not properly find the attribute (or even the "user").
> 
> Is there something obvious that I am missing?
> 
> Changing the attribute set call in the FlowScript to  
> "cocoon.session.user = employee;" yields identical results 
> (though I do  
> like that more).
> 
> Thank you!


Hmmm, I can't tell you why this doesn't work as expected for you but why
don't you pass the objects using

  cocoon.sendPage( "myPipeline", {user : user} );

--
Reinhard


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message