Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

Re: custom tag - param passing prob

Fei Yang

2007-03-08

Replies:

pageContext.getParameter won't compile, because there's no such method
defined

In your code, <JavaComponents:calendar prevMonth="<%= prevMonth %>" />,
the second prevMonth should be a variable defined your jsp.
There should something like <% int prevMonth = request.getParameter
("prevMonth")%>
somewhere before that line.
The first prevMonth is an attribute of your custom tag. Don't confuse
yourself


On 3/8/07, Graeme McLaren <iamnotregistered@(protected):
>
> Hi there, prevMonth is defined in my extended BodyTagSupport class. I
> also
> tried something like this within the JSP which didn't work:
>
> <%!
>   int prevMonth = pageContext.getParameter("prevMonth");
>   int nextMonth = request.getParameter("nextMonth");
> %>
>
>
> Not really sure on this at all, any suggestions?
>
> Thank you for your reply.
>
> Graeme :)
>
>
> >From: Fei Yang <fyang1024@(protected)>
> >Reply-To: A mailing list about Java Server Pages specification and
> >reference <JSP-INTEREST@(protected)>
> >To: JSP-INTEREST@(protected)
> >Subject: Re: custom tag - param passing prob
> >Date: Thu, 8 Mar 2007 15:55:01 +1100
> >MIME-Version: 1.0
> >Received: from swjscmail2.java.sun.com ([192.18.99.108]) by
> >bay0-mc12-f10.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668);
> Wed,
> >7 Mar 2007 21:05:58 -0800
> >Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by
> >swjscmail2.java.sun.com (Postfix) with ESMTPid 7B8B821A8B; Wed, 7 Mar
> 2007
> >22:02:05 -0700 (MST)
> >Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8e
> )
> >with       spool id 13099812 for JSP-INTEREST@(protected)
> >2007       21:59:25 -0700
> >Received: from ug-out-1314.google.com (ug-out-1314.google.com
> >[66.249.92.170])       by swjscmail1.java.sun.com (Postfix) with ESMTP
> >id A5D6A5BA3 for       <JSP-INTEREST@(protected)
> >21:49:17 -0700 (MST)
> >Received: by ug-out-1314.google.com with SMTP id z38so880838ugc for
> > <JSP-INTEREST@(protected))
> >Received: by 10.115.74.1 with SMTP id b1mr2478586wal.1173329701280; Wed,
> 07
> >Mar       2007 20:55:01 -0800 (PST)
> >Received: by 10.114.185.18 with HTTP; Wed, 7 Mar 2007 20:55:01 -0800
> (PST)
> >X-Message-Info: txF49lGdW40/Xr+yw2JginRAHJKTIyxpTzio6/F1lg8=
> >X-Original-To: JSP-INTEREST@(protected)
> >Delivered-To: JSP-INTEREST@(protected)
> >DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta;
> >
>
> >h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
> >
>
> >b=n3SuD7Su3ZeJV34MPxtLCcO9ol9+ReXnjmMD73kton7YqwIGhlB0Mk0jAFhUtbS+Ko+C7uDBPFblsW2WTsYDo0bFfZyiqoFs2mm3MMLb+C/hBtn6ACBVUgBgQ8RxJnRpmGKozy8Lb6V5hGu0vY52tBmc3cGXoJ+vEVwDg/H1Hl8=
> >DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta;
> >
>
> >h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
> >
>
> >b=Ej6IqSv5R0W6Z1R+GHoMCp5BM6DRV/CBDBMJOm4t8XG7dqku+UaNlDLxTl2s3DpOjcJ1nhuzrxI/fTr8VSGVME/4jS9j87sZhl60nS4qHvvT1kkXpdF13kQqDXKzQTgZsKNjLTAzYghuShr+8sQpKPsXgiRUt+S2UfYtqo+bXsE=
> >References: <BAY138-F267A9D37C8066B89A1FDAFD77A0@(protected)>
> >Precedence: list
> >Return-Path: owner-jsp-interest@(protected)
> >X-OriginalArrivalTime: 08 Mar 2007 05:06:04.0064 (UTC)
> >FILETIME=[78C94A00:01C7613F]
> >
> >Where did you define the "prevMonth" between "<%=" and "%>" ?
> >
> >On 3/8/07, Graeme McLaren <iamnotregistered@(protected):
> >>
> >>Hi all, I am building my first custom tag and I want to pass a value to
> >>variable around from a jsp to the custom tag:
> >>
> >><JavaComponents:calendar prevMonth="<%= prevMonth %>" />
> >>
> >>When I try to to run the JSP I get an error:
> >>
> >>org.apache.jasper.JasperException: Unable to compile class for JSP
> >>
> >>An error occurred at line: 23 in the jsp file: /calendarTag.jsp
> >>
> >>Generated servlet error:
> >>   [javac] Compiling 1 source file
> >>
> >>
>
> >>C:\Tomcat\work\Catalina\localhost\_\org\apache\jsp\calendarTag_jsp.java:90:
> >>cannot resolve symbol
> >>symbol : variable prevMonth
> >>location: class org.apache.jsp.calendarTag_jsp
> >>     _jspx_th_JavaComponents_calendar_1.setPrevMonth( prevMonth );
> >>                                     ^
> >>1 error
> >>
> >>
> >>Can anyone suggest anything to help get this working?
> >>
> >>
> >>Cheers in advance,
> >>
> >>Graeme :)
> >>
> >>
>
> >>===========================================================================
> >>To unsubscribe: mailto listserv@(protected)
> >>JSP-INTEREST".
> >>For digest: mailto listserv@(protected)
> >>DIGEST".
> >>
> >>Some relevant archives, FAQs and Forums on JSPs can be found at:
> >>
> >>http://java.sun.com/products/jsp
> >>http://archives.java.sun.com/jsp-interest.html
> >>http://forums.java.sun.com
> >>http://www.jspinsider.com
> >>
> >
>
> >===========================================================================
> >To unsubscribe: mailto listserv@(protected)
> >JSP-INTEREST".
> >For digest: mailto listserv@(protected)
> >DIGEST".
> >
> >Some relevant archives, FAQs and Forums on JSPs can be found at:
> >
> >http://java.sun.com/products/jsp
> >http://archives.java.sun.com/jsp-interest.html
> >http://forums.java.sun.com
> >http://www.jspinsider.com
>
>
> ===========================================================================
> To unsubscribe: mailto listserv@(protected)
> JSP-INTEREST".
> For digest: mailto listserv@(protected)
> DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
> http://java.sun.com/products/jsp
> http://archives.java.sun.com/jsp-interest.html
> http://forums.java.sun.com
> http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com
©2008 junlu.com - Jax Systems, LLC, U.S.A.