cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yann" <ylelo...@ims.ltd.uk>
Subject Re: login concept
Date Thu, 22 Jun 2000 12:06:49 GMT
> Sounds good but how does your XSLT/XSP looks like then?
> Could you send a snipped for demonstration

Hi,

Here is one of my XSP page that does the trick. Note that the Access bean
takes the session as a constructor parameter so that it can access session
variables like username. It is totally hidden from the XSP.

<?xml version="1.0" ?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="../presentation/etape.xsl" type="text/xsl"?>
<?xml-logicsheet href="../main/menulogic.xsl"?>

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

 <xsp:structure>
  <xsp:include>ltd.ims.etape.*</xsp:include>
  <xsp:include>ltd.ims.etape.exception.*</xsp:include>
  <xsp:include>ltd.ims.etape.business.*</xsp:include>
 </xsp:structure>

 <page title="Book a Tape In">
  <xsp:logic>
   String sDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
   String sDatabase = "jdbc:odbc:Tape";

   ltd.ims.etape.Access access = new ltd.ims.etape.Access(session, request,
sDriver, sDatabase);
   if (!access.allow()) {

response.sendRedirect("../login/login.xml?redirect=../manage/bookin.xml");
    return;
   }

   String sUserID = access.getUser().getID();

   try {
    Tape tape = new Tape(sDriver, sDatabase);
    String sTapeNo = tape.bookin(sUserID);
    <![CDATA[
     response.sendRedirect("doaddjob.xml?tapeno=" + sTapeNo + "&lineno=0");
    ]]>
    return;
   } catch (ETapeException e) {
    <xsp:content>
    <panel>
     <insertmenu/>
     <panelcontent>
      <p>There was a problem booking a tape in:</p>
      <p><xsp:expr>e.toString()</xsp:expr></p>
     </panelcontent>
    </panel>
    </xsp:content>
   }
  </xsp:logic>
 </page>

</xsp:page>


Mime
View raw message