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:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 1:51 PM
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
Sent: Dienstag, 23. April 2002 20:46
To: '[EMAIL PROTECTED]'
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 < 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:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 1:15 PM
To: [EMAIL PROTECTED]
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>
---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>
---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>
---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>