Dear Geert,
I have noticed that if I use fragmented scriplets (to embed html code in
between two fragments), then if I declare a local variable in the first
fragment of the scriplet, then the same variable is not accessible in the
second fragment.
As a result, I have been declaring some variables in the declaration tag <%!
%>.
Kindly, inform the way out of this problem, so that I do not have to declare
the vars. in the declaration tag
<%! %>.
Thanx in advance.
Sunil K. Roy
----- Original Message -----
From: "Geert Van Damme" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 21, 2001 12:29 PM
Subject: Re: difference between variable declared using <%! %> and <% %>
> NOPE.
> It has nothing to do with 'static'.
> You cannot do <% static int a; %>.
> <%! defines the servlet instance variables. Since there's only one servlet
> instance that handles every request, you might interpret it as 'something
> like global vars'. But then again, globals are evil.
>
>
> Geert Van Damme
>
>
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Shawn Zhu
> > Sent: woensdag 21 februari 2001 3:01
> > To: [EMAIL PROTECTED]
> > Subject: Re: difference between variable declared using <%! %> and <% %>
> >
> >
> > Is it, in other words, <% static int a; %> achieves the same thing as
> > <%! int a;%> but with safe threading?
> >
> > > -----Original Message-----
> > > From: Robert Nicholson [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, February 20, 2001 5:18 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: difference between variable declared using <%!
> > > %> and <% %>
> > >
> > >
> > > You shouldn't use <%! to declare variables because they will end up as
> > > instance variables and not "automatic" variables that exist
> > > only for the
> > > life time of the _jsp_service method.
> > >
> > > <%! will end up in a Servlet as instance variables.
> > >
> > > > -----Original Message-----
> > > > From: A mailing list about Java Server Pages specification
> > > and reference
> > > > [mailto:[EMAIL PROTECTED]]On Behalf Of Dave Deniman
> > > > Sent: Tuesday, February 20, 2001 5:07 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: difference between variable declared using <%!
> > > %> and <% %>
> > > >
> > > >
> > > > Geert,
> > > >
> > > > You are listed as a contributor to the book Professional JSP, by
> > > > Wrox Press.
> > > > On page 32 of that book, it clearly describes <%! %> as enclosing a
> > > > declaration block for variables and methods. The only fault I see
> > > > in Surya's
> > > > explanation below is not further explaining what is meant
> > > by "valid in the
> > > > page scripting language," or explaining the scope of
> > > declarations in the
> > > > block and the JSP relationship.
> > > >
> > > > Is it possible you are making reference to the concurrency
> > > problems when
> > > > using the declaration scripting element in JSP vs. Servlets? Of
> > > > course, the
> > > > original inquiry from Kishor did not state whether he was
> > > using a Servlet.
> > > > And then too, this becomes an implementation design issue
> > > as opposed to a
> > > > simple functionality issue.
> > > >
> > > > Perhaps the book is in error. Please clarify what you mean
> > > by, "<%! %> is
> > > > NOT meant to declare variables."
> > > >
> > > > Thanks,
> > > > Dave Deniman
> > > >
> > > > ----- Original Message -----
> > > > From: "Da-Ming Duan" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Tuesday, February 20, 2001 4:49 PM
> > > > Subject: Re: difference between variable declared using <%!
> > > %> and <% %>
> > > >
> > > >
> > > > : Discussion is always welcome! Geert, can you please explain the
> > > > difference? I
> > > > : believe you can.
> > > > :
> > > > : DMD
> > > > :
> > > > : Geert Van Damme wrote:
> > > > :
> > > > : > NO NO NO
> > > > : >
> > > > : > If you don't know what <%! %> exactly does. Don't use it.
> > > > : > And you apparently don't know it.
> > > > : >
> > > > : > <%! %> is NOT meant to declare variables.
> > > > : >
> > > > : > Again an example of a really bad post. If you don't
> > > know it. Please,
> > > > don't
> > > > : > answer, or at least specify that it's only a wild guess
> > > > : >
> > > > : > Geert Van Damme
> > > > : >
> > > > : > > -----Original Message-----
> > > > : > > From: A mailing list about Java Server Pages specification and
> > > > reference
> > > > : > > [mailto:[EMAIL PROTECTED]]On Behalf Of Surya Prakash
> > > > : > > Sent: maandag 19 februari 2001 9:59
> > > > : > > To: [EMAIL PROTECTED]
> > > > : > > Subject: Re: difference between variable declared using <%!
> > > > %> and <%
> > > > %>
> > > > : > >
> > > > : > >
> > > > : > > hi kishor
> > > > : > > <%! %> it declares variables or methods valid in
> > > > : > > the page scripting language
> > > > : > > <%%> contains a codefragment valid in the page scripting
> > > > : > > language
> > > > : > > this may help u
> > > > : > > surya
> > > > : > > ----- Original Message -----
> > > > : > > From: "Kishor K" <[EMAIL PROTECTED]>
> > > > : > > To: <[EMAIL PROTECTED]>
> > > > : > > Sent: Monday, February 19, 2001 9:34 AM
> > > > : > > Subject: difference between variable declared using
> > > <%! %> and <% %>
> > > > : > >
> > > > : > >
> > > > : > > > hi,
> > > > : > > >
> > > > : > > > can anyone tell me the difference between variable
> > > declared using
> > > > <%! %>
> > > > : > > and
> > > > : > > > <% %>
> > > > : > > >
> > > > : > > > thanx in advance
> > > > : > > > kishor
> > > > : > > >
> > > > : > > >
> > > > : > > > _________________________________________________________
> > > > : > > > Do You Yahoo!?
> > > > : > > > Get your free @yahoo.com address at http://mail.yahoo.com
> > > > : > > >
> > > > : > > >
> > > > : > >
> > > ==================================================================
> > > > : > > =========
> > > > : > > > To unsubscribe: mailto [EMAIL PROTECTED] with
> > > body: "signoff
> > > > : > > JSP-INTEREST".
> > > > : > > > For digest: mailto [EMAIL PROTECTED] with body: "set
> > > > JSP-INTEREST
> > > > : > > DIGEST".
> > > > : > > > 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".
> > > > : > > For digest: mailto [EMAIL PROTECTED] with body: "set
> > > > : > > JSP-INTEREST DIGEST".
> > > > : > > 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".
> > > > : > For digest: mailto [EMAIL PROTECTED] with body:
> > > "set JSP-INTEREST
> > > > DIGEST".
> > > > : > 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".
> > > > : For digest: mailto [EMAIL PROTECTED] with body: "set
> > > JSP-INTEREST
> > > > DIGEST".
> > > > : 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".
> > > > For digest: mailto [EMAIL PROTECTED] with body: "set
> > > > JSP-INTEREST DIGEST".
> > > > 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".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set
> > > JSP-INTEREST DIGEST".
> > > 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".
> > For digest: mailto [EMAIL PROTECTED] with body: "set
> > JSP-INTEREST DIGEST".
> > 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".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> 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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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