cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Bernhardt <mbernha...@swsgmbh.de>
Subject Re: Problem using taglib in custom logicsheet
Date Wed, 14 Jun 2000 13:45:33 GMT
Hi

ok, the following works now:
  <xsl:template match="calendar:month">
   <xsl:variable name="param">
    <xsp:expr>request.getParameter("month")</xsp:expr>
   </xsl:variable>
   <xsp:expr>
    <xsl:copy-of select="$param"/>
   </xsp:expr>
  </xsl:template>

But, why cant I do something like this:
  .....
  <xsl:template match="xsp:page">
    <xsp:page>
      .....
      <xsp:logic>
        private static String getMonth() {
          return request.getParameter("month");
        }
      </xsp:logic>
      .....
    </xsp:page>
  </xsl:template>

  <xsl:template match="calendar:month">
   <xsp:expr>getMonth()</xsp:expr>
  </xsl:template>

The following error occurs:
  java.lang.Exception: XSP Java Compiler:
   Compilation failed for _calendar_dynamic.java 39:
    Undefined variable or class name: request
          String month = request.getParameter("month");
                         ^
  at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJavaProcessor.java:159)

  at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:451)
  at org.apache.cocoon.Engine.handle(Engine.java:305)
  at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:311)
  at org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)
  at org.apache.jserv.JServConnection.run(JServConnection.java:188)
  at java.lang.Thread.run(Thread.java)


Markus



Ulrich Mayring wrote:

> Markus Bernhardt wrote:
> >
> > Now I want replace the static content with my own dynamic
> > tags. I want evaluate a request-parameter, do some java
> > stuff, and then output the result. Now I dont know, how
> > and where to do it.
>
> Hi Markus,
>
> here is some working code for evaluating parameters:
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
> <?cocoon-process type="xsp"?>
>
> <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>
> <page>
>
> <xsp:logic>
>         Enumeration e = request.getParameterNames();
>         ... do something with all params ...
>         String myparam = request.getParameter("myparam");
>         ... do something with a specific param ...
> </xsp:logic>
>
> </page>
>
> </xsp:page>
>
> Or, in a stylesheet:
>
> <xsl:variable
> name="myparam"><xsp:expr>request.getParameter("myparam")</xsp:expr></xsl:variable>
>
> Ulrich
>
> --
> Ulrich Mayring
> DENIC eG, Systementwicklung
>
> ---------------------------------------------------------------------
> 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