Looks like you put that xsp:logic tag before any content on the page, thus
the code was placed outside the generate method, and from the sound of the
error, before the class definition.  if that's not enough of a clue, send
the xsp here (from the beginning up to the snippet you include below)

Go look at the code this generates - there will be a java file called
details_xsp.java under the work directory of your servlet container (eg
tomcat/work/...) if you're on unix or have cygwin try find . -name
"details_xsp.java" -print

Geoff
-----Original Message-----
From: Collin VanDyck [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 14, 2003 9:59 AM
To: [EMAIL PROTECTED]
Cc: David Cummings
Subject: Re: Pass custom parameters into an XSP


Hi

When I try this out, I get the following message:

org.apache.cocoon.www.tasks.docs.workflow.details_xsp should be declared
abstract; it does not define method generate() in interface
org.apache.cocoon.generation.Generator

In my first xsp:logic tag, this is the code that causes this error:

try {
String workflowIdStr = this.parameters.getParameter("workflowId");
} catch (ParameterException e) {
}

Any ideas?? Thanks again!

Collin
----- Original Message -----
From: Nathaniel Alfred
To: [EMAIL PROTECTED]
Sent: Wednesday, February 12, 2003 6:50 PM
Subject: RE: Pass custom parameters into an XSP


Actually, you don't need to override setup().
The base class of the XSP generated class already does that and provides
"protected Parameters parameters;"

You can use directly in <xsp:logic>

String entityType = this.parameters.getParameter("entityType");

including the other nice features of Parameters such as defaulting and
converting to int, boolean, and so on.
-----Original Message-----
From: Collin VanDyck [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 13. Februar 2003 00:04
To: [EMAIL PROTECTED]
Cc: David Cummings
Subject: Re: Pass custom parameters into an XSP


Wow. I did not know you could use the XSP to override the setup method.
That is VERY helpful. Thanks!!


----- Original Message -----
From: Marco Rolappe
To: [EMAIL PROTECTED]
Sent: Wednesday, February 12, 2003 5:59 PM
Subject: AW: Pass custom parameters into an XSP


hi collin,

with XSPs an easier alternative would be to pass your 'parameter' as a
request parameter.

then you would:

<map:match pattern="edit.xml">
    <map:generate type="serverpages" src="/docs/edit/item.xsp"/>
    <map:serialize type="xml"/>
</map:match>

<map:match pattern="edit/*">
    <map:generate src="cocoon:/edit.xml?entityType={1}"/>
    ...
</map:match>

then you can get the request parameter from within your XSP via the request
logicsheet (<xsp-request:get-parameter>) or via embedded logic
(request.getParameter ()).


the other alternative; passing the parameter as a sitemap parameter:

<map:match pattern="edit/*">
    <map:generate type="serverpages" src="/docs/edit/item.xsp">
        <map:parameter name="entityType" value="{1}"/>
    </map:generate>
    ...
</map:match>

for this to work you have to embed the appropriate logic into your XSP for
retrieving that parameter; as your compiled XSP is a generator in the end
you accomplish this by overriding its setup() method and process the
parameter(s) there.

just as a hint (take a look at the respective sources/docs):

<xsp:page language="java" ...>
<xsp:logic>    <!-- must occur before content so that it doesn't become part
of content/generate() method -->
    public void setup (SourceResolver resolver, Map objectModel, String src,
Parameters params) throws ...
    {
        // process parameter(s) here
        ...

        super.setup (resolver, objectModel, src, params);
    }
</xsp:logic>

<!-- content here -->
</xsp:page>

HTH
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]Im Auftrag
von Collin VanDyck
Gesendet: Mittwoch, 12. Februar 2003 22:44
An: [EMAIL PROTECTED]
Betreff: Pass custom parameters into an XSP


Hello,

I am trying to figure out how I can pass in custom parameters into an
already existing generator such as the XSP/serverpages generator.  Here's my
scenario:

I receive a request for /edit/page

Which matches /edit/*

So from this matcher, I have {1} == "page".. I want to pass this off to
let's say

/docs/xsp/edit/item.xsp  as a parameter named "entityType"

So that in the XSP I can access the "entityType" variable.

I think I'm missing something obvious. If someone could point me into the
right direction, I'd really appreciate it.

thanks,
Collin



This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. If
you receive this message in error, please notify the sender urgently and
then immediately delete the message and any copies of it from your system.
Please also immediately destroy any hardcopies of the message. You must not,
directly or indirectly, use, disclose, distribute, print, or copy any part
of this message if you are not the intended recipient. The sender's company
reserves the right to monitor all e-mail communications through their
networks. Any views expressed in this message are those of the individual
sender, except where the message states otherwise and the sender is
authorised to state them to be the views of the sender's company.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to