Hello,

I need to know which user is logged on inside a Cocoon-XSP-page in
Jetspeed 1.2b1.

I created the following index.xml und index.xsl pages, but it turns out
that
rundata.getUser() is always empty (the output is "???" in the below
example).
So the question is:
How can I get the name of the current user inside a Cocoon-XSP-page ???

It would be a cool thing to have Cocoon-XSP (dynamic-java-programming
on-the-fly without change of the jetspeed/cocoon system!!!) up and
running -
but a important thing would be the full access to the rundata of
jetspeed/turbine.


index.xml:
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="index.xsl" type="text/xsl"?>

<xsp:page language="java"
          xmlns:xsp="http://www.apache.org/1999/XSP/Core">

    <xsp:structure>
        <xsp:include>org.apache.turbine.util.*</xsp:include>
        <xsp:include>org.apache.turbine.om.user.*</xsp:include>
        <xsp:include>org.apache.jetspeed.daemon.*</xsp:include>
        <xsp:include>org.apache.jetspeed.daemon.impl.*</xsp:include>
        <xsp:include>org.apache.jetspeed.portal.util.*</xsp:include>
        <xsp:include>org.apache.jetspeed.portal.*</xsp:include>
        <xsp:include>org.apache.jetspeed.portal.factory.*</xsp:include>
        <xsp:include>org.apache.jetspeed.util.servlet.*</xsp:include>
    </xsp:structure>

    <portletlist>

        <xsp:logic>
            RunData rundata = RunDataFactory.getRunData( request,
response, new JetspeedServletConfig() );

            String user = "???";
     if (rundata.getUser() != null) { user =
rundata.getUser().getUserName(); };
<!--     if (rundata.getUser() != null) if
(rundata.getUser().hasLoggedIn()) { user =
rundata.getUser().getUserName(); }; -->
<!--     if (rundata.getUser() != null &&
rundata.getUser().hasLoggedIn() ) { user =
rundata.getUser().getUserName(); }; -->

         </xsp:logic>

        <user>
            <xsp:expr>user</xsp:expr>
        </user>

    </portletlist>


</xsp:page>

index.xsp:
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


    <xsl:template match="portletlist">

        <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>

        <div>

            <ul>
                <br>

                <p>
                Hello
                <xsl:value-of select="./user"/>
                </p>

            </ul>

        </div>

    </xsl:template>


</xsl:stylesheet>

��z��v�^!���6�i�Zr���j�Ӣ˛���m�޶�^y�'�+-Š�x��d�{.n�+���z�)y�h}�b��(�H���
 ��&�!���jwN����i�����ay���
躗(��cz�)y�O���zk#�|(�H��� ��&

Reply via email to