Werner,
I actually have tried that and the result was a NullPointerException because String productId = request.getParameter("productid"); gets declared at the class level (i.e. before any method declarations). I suppose request is not available in this scope? Sonny --- Werner Guttmann <[EMAIL PROTECTED]> wrote: >Btw, you do not have to change it to the suggested way. Using a logicsheet within a ><xsp:logic> element makes perfectly sense ... > >I think in your case, just make sure that you move the code that assigns the value of >the productId request parameter to your local variable before trying to generate the >content. In other words, > ><page> > > <xsp:logic> > String productId = request.getParameter("productid"); > </xsp:logic> > > <Product> > <xsp:attribute> > <xsp:expr>products.getCategory(productId)</xsp:expr> > </xsp:attribute> > > [snip] > </Product> > ></page> > >should do the job. > >Werner > >Sonny Sukumar wrote: > >> 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]> > > >--------------------------------------------------------------------- >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]>