cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gorillacommunications" <le...@gorillacommunications.com>
Subject help with XSP, maybe actions
Date Fri, 31 May 2002 16:48:45 GMT
Hi All,

I am having trouble getting some XSP to run. I have a small login form:

<html>
  <head>
    <title></title>
  </head>
  <body>
    <form action="login" method="POST">
      UserID:<input size="" value="" name="userID" type="text">
      Password:<input size="" value="" name="pwd" type="password">
      <input value="Login" name="Login" type="submit">
      <input value="Reset" name="Reset" type="reset">
    </form>
  </body>
</html>

and a pipleline:

  <map:pipeline>
    <map:match pattern="login">
      <map:generate src="login.xml"/>
      <map:serialize type="html"/>
    </map:match>
  </map:pipeline>

and a login.xml page (stripped down to show essentials):

<?xml version="1.0" encoding="utf-8"?>
<xsp:page language="java"
 xmlns:xsp="http://apache.org/xsp"
 xmlns:util="http://www.apache.org/1999/XSP/Util"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xalan="http://xml.apache.org/xslt.extensions.Redirect"
 extension-element-prefixes="xalan"
 xmlns:lxslt="http://xml.apache.org/xslt"
 version="1.0">

  <xsp:structure>
    <xsp:include>java.lang.*</xsp:include>
    <xsp:include>java.util.*</xsp:include>
    <xsp:include>java.io.*</xsp:include>

  </xsp:structure>
  <page>
   <xsp:logic>
      String strUserID;
      String strPwd;

      strUserID = request.getParameter("userID");
      strPwd = request.getParameter("pwd");

      try


        // some code for validating the userID and pwd
      }
      catch (Exception e)
      {
        e.printStackTrace(System.err);
      }

      // redirect to login page or summary
     String strHttp;
      if (// login failed)
      {
        strHttp = "http://localhost:8080/GS/gs.xml?fail=true";
      }
      else
      {
        strHttp = "http://localhost:8080/GS/gs.xml?pagename=summary";
      }
      try


        response.sendRedirect(strHttp);
      }
      catch (Exception e)
      {
        e.printStackTrace(System.err);
      }
    </xsp:logic>
  </page>
</xsp:page>

The problem is that when I enter a userID and pwd and click on "Login", the
Java code is not executed, rather it is just displayed in the browser like:

java.lang.* java.util.* java.io.* String strUserID; String strPwd; strUserID
= request.getParameter("userID");strPwd = request.getParameter("pwd");
try{// some code for validating the userID and pwd) catch (Exception e)

and so on.

Can anyone tell me what I'm doing wrong? I've read in the docs and archives
that
maybe I should be doing this with actions, but the sample I found for a
login page
uses the FormValidator, and I don't think I need that.

The reason I am doing it this way, is because I have this application
running in
C1 and would like to reuse much of the XSP. In that version my form
action="login.xml"
and it works just fine.

Also, if anyone knows of a good tutorial for actions, I would love to see
it. To me, this
is the most confusing part of C2 so far. I have done extensive searches and
come up
with little.

Many thanks,
Leona Slepetis



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message