Hi there, I've added in the following line:

<% String prevMonth = request.getParameter("prevMonth"); %>

I declared prevMonth as a string as I was getting a type mismatch error,
which I still get anyway because my set method declares an int.  However
this is looking much more promising.

Do all variables get passed as a String from a JSP to a Tag class?

It looks like I need to use parseInt to get the String back to an int.
Should this be done in the JSP or the Tag class?  I'm not clear on how I'd
do that, any suggestions?

Your help is much appreciated, thank you.


Graeme :)

From: Fei Yang <[EMAIL PROTECTED]>
Reply-To: A mailing list about Java Server Pages specification and
reference <JSP-INTEREST@JAVA.SUN.COM>
To: JSP-INTEREST@JAVA.SUN.COM
Subject: Re: custom tag - param passing prob
Date: Thu, 8 Mar 2007 16:23:41 +1100
MIME-Version: 1.0
Received: from swjscmail2.java.sun.com ([192.18.99.108]) by
bay0-mc4-f8.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 7
Mar 2007 21:24:11 -0800
Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by
swjscmail2.java.sun.com (Postfix) with ESMTPid 5085E21E45; Wed,  7 Mar 2007
22:20:43 -0700 (MST)
Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8e)
with          spool id 13102370 for JSP-INTEREST@JAVA.SUN.COM; Wed, 7 Mar
2007          22:17:56 -0700
Received: from wr-out-0506.google.com (wr-out-0506.google.com
[64.233.184.229])          by swjscmail1.java.sun.com (Postfix) with ESMTP
id 1C77651A7 for          <JSP-INTEREST@java.sun.com>; Wed,  7 Mar 2007
22:17:56 -0700 (MST)
Received: by wr-out-0506.google.com with SMTP id i23so714485wra for
 <JSP-INTEREST@java.sun.com>; Wed, 07 Mar 2007 21:23:42 -0800 (PST)
Received: by 10.114.190.6 with SMTP id n6mr5881waf.1173331421434; Wed, 07
Mar          2007 21:23:41 -0800 (PST)
Received: by 10.114.185.18 with HTTP; Wed, 7 Mar 2007 21:23:41 -0800 (PST)
X-Message-Info: txF49lGdW40VlI4izmpOPJROrYRyWHYOO1lfg950PgA=
X-Original-To: JSP-INTEREST@java.sun.com
Delivered-To: JSP-INTEREST@java.sun.com
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=rgYVWf/upF7vGZZ30sI08DBP/fgjfWZ/q4W1YtIPfFaFs+UWXC0QC1NqBVRboLItdafBTRxfB3FlhWLUR3GhdKglcWVxnxaK0donajghjtJwlk0wPoKrhpdMYFZFQ0srd5LPnIPKZCKlwkSNw8e8YHLGfzVjYF9nhGM9qP8kXos=
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=PahFyNpp7LEFosbY09wqtapFTrMemPXgutNrBKI+c+0xDXj67F84yztzAnKPo9uux2TNri2jYmInef/6JhXuLFuiT2f07YBDQTRkdCA11EdC/G5sEwNtoMfUfAnZzeoutGPkxM1dO0yVV3b37YRVNRvG5EyVwyvfydcyz6zbIvM=
References: <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
Precedence: list
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 08 Mar 2007 05:24:12.0485 (UTC)
FILETIME=[01892750:01C76142]

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 <[EMAIL PROTECTED]> wrote:

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 <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>reference <JSP-INTEREST@JAVA.SUN.COM>
>To: JSP-INTEREST@JAVA.SUN.COM
>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@JAVA.SUN.COM; Wed, 7
Mar
>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@java.sun.com>; Wed,  7 Mar 2007
>21:49:17 -0700 (MST)
>Received: by ug-out-1314.google.com with SMTP id z38so880838ugc for
>  <JSP-INTEREST@java.sun.com>; Wed, 07 Mar 2007 20:55:02 -0800 (PST)
>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@java.sun.com
>Delivered-To: JSP-INTEREST@java.sun.com
>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: <[EMAIL PROTECTED]>
>Precedence: list
>Return-Path: [EMAIL 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 <[EMAIL PROTECTED]> wrote:
>>
>>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 [EMAIL PROTECTED] with body: "signoff
>>JSP-INTEREST".
>>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>>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 [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>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 [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
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 [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
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 [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST 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

Reply via email to