You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by gorillacommunications <le...@gorillacommunications.com> on 2002/05/31 18:48:45 UTC

help with XSP, maybe actions

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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: CDATA output / Server Upgrage

Posted by KOZLOV Roman <r-...@opencascade.com>.
You could try xsl:text with disable-output-escaping attribute:
<xsl:text disable-output-escaping="yes"><![CDATA[ some characters like <
>...]]></xsl:text>

Roman

George Pieri wrote:

> In alot of our xsl stylesheets we wrap xml and
> javascrip within !<CDATA[  xxxx  ]]> tags
> so that it is not parsed.
>
> This has worked well for us with the output being
> delivered successfully.
>
> Using the new version of our web server, Weblogic 7.0,
> this appears no longer to work and our CDATA sections
> get interperted and changed to &lt;  xxxxx &gt; tags !?!
>
> What could be affecting this. Any ideas ?
>
> e.g.
> ---------------
> xsl code
> ----------------
>  <maintag></maintag>
>  <![CDATA[<maintag></maintag>]]>
>
> ---------
> output
> --------
> <maintag></maintag>
> &lt;maintag&gt;&lt;/maintag&gt;
>
> ------------------------------------------
> output in previous version of web server
> ----------------------------------------
> <maintag></maintag>
> <maintag></maintag>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


CDATA output / Server Upgrage

Posted by George Pieri <ge...@wcom.com>.
In alot of our xsl stylesheets we wrap xml and
javascrip within !<CDATA[  xxxx  ]]> tags
so that it is not parsed.

This has worked well for us with the output being
delivered successfully. 

Using the new version of our web server, Weblogic 7.0, 
this appears no longer to work and our CDATA sections
get interperted and changed to &lt;  xxxxx &gt; tags !?!


What could be affecting this. Any ideas ?


e.g.
---------------
xsl code
----------------
 <maintag></maintag>
 <![CDATA[<maintag></maintag>]]>

---------
output
--------
<maintag></maintag>
&lt;maintag&gt;&lt;/maintag&gt;

------------------------------------------
output in previous version of web server
----------------------------------------
<maintag></maintag>
<maintag></maintag>


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: help with XSP, maybe actions

Posted by Artur Bialecki <ar...@digitalfairway.com>.
In your pipe ine you need to specify serverpages type for the
generator, otherwise it will use the straight file generator.
So try this <map:generate type="serverpages" src="login.xml"/>
Also you don't seem to have any transformes to convert the 
generated xml to html/xhtml before you serialize it, you may
want to add that too.

Artur...


> -----Original Message-----
> From: gorillacommunications [mailto:leona@gorillacommunications.com]
> Sent: Friday, May 31, 2002 12:49 PM
> To: cocoon-users@xml.apache.org
> Subject: help with XSP, maybe actions
> 
> 
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>