Put each of these tags in a jsp file.  Then look at the generated java code.
You'll see the difference.

<%! %> is a _declaration_.

<%  %> is a _scriptlet_.

_declaration_ declares things that are in the resulting servlet class.
E.g. class member variables or methods.

_scriptlet_ is code that gets expanded into the service method.

Soooo.. this means that variables in the _declaration_ are shared for
all requests, while the _scriptlet_ variables are instantiated
on the stack for each request.

See page 33 of Professional JSP from wrox press for more info.

-----Original Message-----
From: SANDEEP UPPAL <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, September 25, 2000 1:47 AM
Subject: Re: difference between <%!...%> and <%....%>


>all the processing code we write is in jsp_Service method so how does it
>make a difference.
>
>regards,
>
>Sandeep
>----- Original Message -----
>From: Shibu Up <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Monday, September 25, 2000 1:56 PM
>Subject: Re: difference between <%!...%> and <%....%>
>
>
>> Hi,
>> <!   declaration is for class level variable  declaration   ( Ps. JSP is
>finally
>> becomes a servlet class).     <% is for normal local variables  in the
>> jsp_Service method.
>>
>> -Shibu
>>
>>
>>
>>
>>
>> SANDEEP UPPAL <[EMAIL PROTECTED]> on 09/25/2000 02:55:55 PM
>>
>> Please respond to A mailing list about Java Server Pages specification and
>>       reference <[EMAIL PROTECTED]>
>>
>> To:   [EMAIL PROTECTED]
>> cc:    (bcc: U P Shibu/LTITL)
>>
>> Subject:  difference between <%!...%> and <%....%>
>>
>>
>>
>> both <%!...%> and <%.....%> can be used for declaring variables.
>>
>> What is the difference between both and which to use ?
>>
>> regards,
>>
>> Sandeep Uppal
>>
>>
>===========================================================================
>> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>> Some relevant FAQs on JSP/Servlets can be found at:
>>
>>  http://java.sun.com/products/jsp/faq.html
>>  http://www.esperanto.org.nz/jsp/jspfaq.html
>>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>>
>>
>===========================================================================
>> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>> Some relevant FAQs on JSP/Servlets can be found at:
>>
>>  http://java.sun.com/products/jsp/faq.html
>>  http://www.esperanto.org.nz/jsp/jspfaq.html
>>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>>
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to