i have a little problems with my session. I use it to login on my site.
I have a login-form where th user must enter his name and password.
Than it is sent to the login.xsp file where a database-connection is
made. It check the user and his password if it ok a session is
create and there is the problem.
I get a NullPointerException, but after a simple reload in the Browser
it works well. It seems there is a problem with logicsheet.
When i create a simply session with:
xmlns:session="http://apache.org/xsp/session/2.0" create-session="true"
and try to set some attributes it works, but if i attempt to create a session with my logicsheet and add some attributes it runs in a NullPointException, after a reload it works.
I must still say the cooky is create.
Can anybody help me with this problem.
bye Raphael
Here are the Files
***** logicsheet.xsl *****
<xsl:template match="my:create-session">
<xsp:logic>
org.apache.cocoon.environment.ObjectModelHelper.getRequest( objectModel).getSession(true);
</xsp:logic>
</xsl:template>
<xsl:template match="my:if-session">
<xsp:logic>
<xls:choose>
<xsl:when test"not(@test) or @test ='true'"> if(org.apache.cocoon.environment.ObjectModelHelper.getRequest(objectModel).getSession(false) != null)
{
</xsl:when>
<xsl:otherwise>
if(org.apache.cocoon.environment.ObjectModelHelper.getRequest(objectModel).getSession(false) == null)
{
</xsl:otherwise>
</xsl:choose>
</xsp:logic>
<xsl:apply-template/>
<xsp:logic>
}
</xsp:logic>
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()">
<xsl:copy>
<xsl:apply-template select="@*|*|text()|processing-instruction()"/>
</xsl:copy
</xsl:template>
</xsl:stylesheet>
***** login.xsp *****
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-logicsheet href="logicsheet.xsl"?>
<xsp:page xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:session="http://apache.org/xsp/session/2.0" create-session="false"
xmlns:my="http://my/logicsheet">
<document>
<my:if-session test="false">
<esql:connection>
<esql:driver>com.mysql.jdbc.Driver</esql:driver>
<esql:dburl>jdbc:mysql://localhost:3306/mysqlcocoon?autoReconnect=true</esql:dburl>
<esql:username>username</esql:username>
<esql:password>password</esql:password>
<esql:execute-query>
<esql:query>select * from passwords
where user ='<xsp-request:get-parameter name="user"/>'
and pass ='<xsp-request:get-parameter name="pass"/>'
</esql:query>
<esql:results>
<my:create-session/>
<esql:row-results>
<!-- i think here is the Problem -->
<session:set-attribute name="user"><esql:get-string column="user"/></session:set-attribute>
<session:set-attribute name="pass"><esql:get-string column="pass"/></session:set-attribute>
</esql:row-results>
</esql:results>
<esql:error-results>Da ging was schief</esql:error-results>
<!--<esql:no-results>Da war nix</esql:no-results> -->
</esql:execute-query>
</esql:connection>
</my:if-session>
<my:if-session test="true"> <login></login> </my:if-session>
<my:if-session test="false"> <nologin></nologin> </my:if-session>
</document> </xsp:page>
***** the sitemap *****
<map:pipeline>
<map:match pattern="home.htm">
<map:generate src="docs/login.xsp" type="serverpages"/> <map:transform src="stylesheets/hometest-to-html.xsl">
<map:parameter name="use-request-parameter" value="true"/>
</map:transform> <map:serialize type="html"/>
</map:match>
</map:pipeline>--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
