cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Salvatore Incandela" <s.incand...@gmail.com>
Subject Problems with requestAttributeSelector
Date Tue, 25 Jul 2006 16:15:36 GMT
Hi! I'm newbie to cocoon...
I've a problem with the request attribute selector.
Considering that i'm very unskilled...this is the problem:

A login page (login.html) with a simple input form, call in the action
parameter ->"login" :

<form action="login" method="post">
   <table>
    <tr>
         <td align="right">User:</td>
         <td align="left"><input type="text" name="user"/></td>
    </tr>
    <tr>
         <td align="right">Password:</td>
         <td align="left"><input type="password" name="pass"/></td>
    </tr>
    <tr>
         <td colspan="2" align="center"><input type="submit"
value="Login"/></td>
    </tr>
   </table>
</form>
------------------------------------------------------------
This "login" is mapped in the sitemap, the generator call login.xsp,
well...the login.xsp verify the pwd and username, and send by the request
an attribute "flag" (a String that can be false or true depending if the pwd
is right!).

<map:selectors default="browser"/>
        <map:selectors default="request-attribute">
            <map:selector name="request-attribute" logger="
sitemap.selector.request-attribute" src="
org.apache.cocoon.selection.RequestAttributeSelector"/>
        </map:selectors>

.
.
.
    <map:match pattern="login.html">
                <map:read mime-type="text/html" src="content/login.html"/>
    </map:match>
.
.
.
.
            <map:match pattern="login">
                <map:generate type="serverpages" src="xsp/login.xsp"/>

                 <map:select type="request-attribute">
                    <map:parameter name="attribute-name" value="flag"/>
                    <map:when test="true">
                        <map:transform type="xslt"
src="style/xsl/main.xsl"/>
                    </map:when>
                    <map:otherwise>
                        <map:redirect-to uri="login.html"/>
                    </map:otherwise>
                </map:select>
                <map:serialize type="html"/>
            </map:match>
-------------------------------------------------------------------------------------
the login.xsp

<xsp:logic>
String flag= new String("false");
 String user = <xsp-request:get-parameter name="user"/>;
 String pwd = <xsp-request:get-parameter name="pass"/>;

 if (user.equals("test") &amp;&amp; pwd.equals("a")) {
    flag = "true";
 } else {
    flag= "false";
 }

  getRequest().setAttribute("flag","true");


</xsp:logic>
----------------------------------------------------------------------------
The selector appear that can't see the request's attribute, because it do
only the otherwise tag freely the flag value...
There is anyone that would to help me??????

Mime
View raw message