cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Schneider" <volker.schnei...@danet.de>
Subject RE: Iteration inside xsp
Date Tue, 23 Apr 2002 19:38:02 GMT
Hi Harry,

thank you for your reply. It tried the "request" variable. I tried to get
the session from the request but it didn't work.
<?xml version="1.0"?>

<xsp:page xmlns:xsp="http://apache.org/xsp"
          xmlns:xsp-session="http://apache.org/xsp/session/2.0"
          create-session="true">

<xsp:structure>
  <xsp:include>org.apache.cocoon.environment.Request</xsp:include>
  <xsp:include>org.apache.cocoon.environment.Session</xsp:include>
</xsp:structure>

  <xsp:logic>
    //---- get the request
    request.getSession();

  </xsp:logic>

</xsp:page>

The error message was:

org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling
ShowRoute_xsp:
Line 70, column 22: <identifier> expected
Line 70, column 12: cannot access class getSession; file
request\getSession.class not found
Line 0, column 0:
2 errors

Do you have an idea, what could be the reason for this?

Thank you, best regards
- Volker -

-----Original Message-----
From: Lai, Harry [mailto:HLai@coremetrics.com]
Sent: Dienstag, 23. April 2002 21:17
To: 'cocoon-users@xml.apache.org'
Subject: RE: Iteration inside xsp


Hi Volker,

In an XSP doc (or logicsheet), there are a set of "built-in" variables that
you can use to access servlet objects (taken from the comments in the java
file derived from an XSP doc):

    /* Built-in parameters available for use */
    // context    - ServletContext
    // request    - org.apache.cocoon.environment.Request
    // response   - org.apache.cocoon.environment.Response
    // parameters - parameters defined in the sitemap

Here's an example that accesses the request:

    <xsp:logic>
      String name = request.getParameter("name");

      if (name != null) {
        <p><b>Hello, <xsp:expr>name</xsp:expr>!</b></p>
      }
    </xsp:logic>

Anyway, I think that's what you were asking about, but if it wasn't, let me
know, and I'll take another shot.  =)

Harry

PS  If you don't want to access the servlet objects directly, Cocoon also
provides some logicsheets that you can use (xsp-request, xsp-response,
xsp-session, xsp-cookie).


-----Original Message-----
From: Volker Schneider [mailto:volker.schneider@danet.de]
Sent: Tuesday, April 23, 2002 1:51 PM
To: cocoon-users@xml.apache.org
Subject: RE: Iteration inside xsp


Hi Harry,

thank you, this helps. But there is another question coming up, maybe you
know the answer as well:

How can I access the session or request object whithin the xsp logic
sheet(<xsp:logic>). Inside the <xsp:expr> I can access it using the
session-namespace. But inside the logic sheet I have no ObjectModel.

Thank you, best regards
- Volker -

-----Original Message-----
From: Lai, Harry [mailto:HLai@coremetrics.com]
Sent: Dienstag, 23. April 2002 20:46
To: 'cocoon-users@xml.apache.org'
Subject: RE: Iteration inside xsp


Hi Volker,

I'm sure there are better tutorials, but this article comparing JSP and XSP
actually has a decent table of XSP tags on page 3.

http://www.onjava.com/pub/a/onjava/2001/02/22/jsp_servlets.html

Also, with regards to your question, there's an example on page 2 of this
article that iterates through an array and outputs each element within its
own xhtml element.  Here's the example:

<table>
  <xsp:logic>
    for (int i = 0; i &lt; items.length; i++) {
      <tr>
        <td>
          <xsp:expr>items[i].getName()</xsp:expr>
        </td>
      </tr>
    }
  </xsp:logic>
</table>

Anyway, hope that helps!

Harry

-----Original Message-----
From: Volker Schneider [mailto:volker.schneider@danet.de]
Sent: Tuesday, April 23, 2002 1:15 PM
To: cocoon-users@xml.apache.org
Subject: Iteration inside xsp


Dear colleagues,

I want to use xsp to retrieve data from the session. The only problem is,
that I cannot put list content out to the xsp page.

If I want to write out a list of names which are stored in a vector, how can
I produce an xsp-page like this:

...
<name>Volker</name>
<name>Peter</name>
<name>Betty</name>
...

an so on. Sure I can iterate in java, but then there must be a chance to
select what data should be put out.

Where can I find a more detailed xsp-tutorial, where every xsp-tag is
declared. The things I found mostly were incomplete.

Best regards
- Volker -


---------------------------------------------------------------------
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>

---------------------------------------------------------------------
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>


---------------------------------------------------------------------
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>

---------------------------------------------------------------------
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>


---------------------------------------------------------------------
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