Artur,

Somehow I couldn't move the the productId declaration & initialization before the 
<Product> tag because this would move it to class level and 1.) the 
<xsp-request:get-parameter> tag must be used within the root element of the generated 
document (for some reason) and 2.) I get a NullPointerException when I try to use 
request.getParameter at the class level.  I have *very* little knowledge of the 
request object and its XML logicsheet wrapper (I'm a newbie :-), so I unfortunately 
can't shed any light on the exact reasons for these things.

HOWEVER: I tried the <xsp:init-page> tag under the <xsp:page> tag (before the 
<Product> tag) and it worked!!  The productId declaration now comes first in the 
generate method so the attribute value can be computed with no problem.

Thanks Artur! :-)

Sonny

--- "Artur Bialecki" <[EMAIL PROTECTED]> wrote:
>
>Can you move your <xsp:logic> before the <Product> tag?
>Or try this
><xsp:init-page>
>   String productId = request.getParameter("productid");
><xsp:init-page/>
>
>although the init-page tag might only work as a child
>of <xsp:page>.
>
>Artur...
>
>> -----Original Message-----
>> From: Sonny Sukumar [mailto:[EMAIL PROTECTED]] 
>> Sent: October 15, 2002 1:58 PM
>> To: [EMAIL PROTECTED]
>> Subject: Can anybody solve this?
>> 
>> 
>> 
>> Hi guys,
>> 
>> I sent the following message (below the line) yesterday and 
>> got one good suggestion to use 
>> 
>> <xsp:logic>
>>     String productId = request.getParameter("productid");
>> </xsp:logic>
>> 
>> instead of 
>> 
>> <xsp:logic>
>>     String productId = <xsp-request:get-parameter name="productid"/>;
>> </xsp:logic>
>> 
>> However, it did not work..same problem with the ordering of 
>> the generated Java code for the XSP which causes productId to 
>> try to be used (to create an attribute value for the root 
>> element) before it is declared.  I would REALLY appreciate 
>> any insight into this.
>> 
>> Thanks. :-)
>> ______________________________________________________________
>> ________________
>> Using: Cocoon 2.0.3 with Tomcat 4.1.12 on Redhat 7.3
>> 
>> My problem is this:  I'm writing an XSP and trying to insert 
>> an attribute
>> in the root element of my document.  The root element is 
>> <Product>, as this
>> doc stores product info.  
>> 
>> Anyhow, a logicsheet inserts an
>> <xsp:attribute>
>>   <xsp:expr>products.getCategory(productId)</xsp:expr>
>> </xsp:attribute>
>> 
>> into my XSP within the <Product> element.  Now, the productId 
>> variable is
>> declared like this *right* below the root <Product> element 
>> in the XSP:
>> 
>> <Product>
>>   <xsp:logic>
>>     String productId = <xsp-request:get-parameter 
>> name="productid" default=""/>;
>>   </xsp:logic>
>>  ...
>> 
>> The problem is that in the Java class generated for the XSP 
>> declares productId
>> AFTER the attribute code tries to call products.getCategory 
>> using productId
>> as a parameter.  This is the ONLY thing causing the error as 
>> far as I can
>> tell, as the code works fine without putting in the attribute.
>> 
>> Note that NO MATTER WHERE the 
>> <xsp:attribute>..</xsp:attribute> code gets
>> inserted within the <Product></Product> block, the generated 
>> Java code still
>> has the same ordering problem.
>> 
>> Does anybody know how to fix this?  I would have put the 
>> productId declaration
>> above the root element (i.e. made it a class member of the 
>> generated Java
>> class), but apparently one can't use the xsp-request 
>> logicsheet tags at the
>> class level.  I don't know why this is the case either.
>> 
>> Thanks for the help!
>> 
>> Sonny
>> 
>> _____________________________________________________________
>> Conserve wilderness with a click (free!) and get your own 
>> EcologyFund.net email (free!) at http://www.ecologyfund.com.
>> 
>> _____________________________________________________________
>> Select your own custom email address for FREE! Get 
>> [EMAIL PROTECTED] w/No Ads, 6MB, POP & more! 
>> http://www.everyone.net/selectmail?> campaign=tag
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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]>
>>

_____________________________________________________________
Conserve wilderness with a click (free!) and get your own EcologyFund.net email 
(free!) at http://www.ecologyfund.com.

_____________________________________________________________
Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, 
POP & more! http://www.everyone.net/selectmail?campaign=tag

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