Ok, this is my solution:

In cocoon.xconf use the JXPathMetaModule:

<input-modules>
     .
     .
     .
     <component-instance
class="org.apache.cocoon.components.modules.input.JXPathMetaModule"    
logger="core.modules.input" name="user-attr">
       <input-module name="session-attr"/>
      <!--usuario is the name of object in session-->
       <parameter>usuario</parameter>
    
</component-instance>
     . 
     .
     .
</input-modules>
  
 
Get the parameter in sitemap. I put the parameter in the sitemap.xmap of
lenya/src/modules/sitetree/
in the the bottom matcher :

<map:match pattern="*/*/*/*/*/**.xml">
        <map:generate src="cocoon:/navtree/{2}/{3}/{4}/{5}/{6}.xml"/>
        <map:transform
src="fallback://lenya/modules/sitetree/xslt/navigation/{1}.xsl">
          <map:parameter name="area" value="{3}"/>
          <map:parameter name="root" value="/{2}/{3}/"/>
          <map:parameter name="chosenlanguage" value="{5}"/>
          <map:parameter name="defaultlanguage" value="{4}"/>
          
          <!-- nombre is the name of attribute in the usuario object. -->       
  
        <map:parameter name='nombre' value='{user-attr:nombre}'/>
                 
          
        </map:transform>       
        <map:serialize type="xml"/>
      </map:match>
  
 Last, in the xsl file :

declare the parameter:

            <xsl:param name="nombre"/>

and print the value:

           <xsl:value-of select="$nombre"/>


Thanks very much.




Frank Hamilton wrote:
> 
> Hi,
> 
> I´m create an usecase that put  "myUser" object in to
> org.apache.cocoon.environment.Session. This is for my own login task in
> Lenya. This usecase create "myUser" object from my own BD (if the user
> exist in BD), and put it in Session.
> 
> My question is: Can I get myUser.getName() from session in
> page2htmlHome.xsl (for example)?. I need this to put the name of loger
> user in the header of my publication.
> 
> Thanks, and excuse my poor English.
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-get-session-Attribute-tp21351269p21438943.html
Sent from the Lenya - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to