Re: Diff between <@ and
Anup wrote:

> what is the difference between <@ and <!--. It seems that only the latter
> works for JSP when using Jrun Webserver. Or am I missing something.
>
> Is <%== another way of putting out.println.

<@ are JSP directives: they affect the rest of the JSP page and act like
pre-processor directives.

<%! is an object level variable declaration.  Each JSP page is compiled into a
servlet with a method: public void _jspService(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException which gets
called when the page is to be serviced.
Thus, <% int a; %> declares a local variable in the _jspService method, while <%!
int a; %> declares a member variable of an instance of the servlet itself.  This
distinction is important if the JSP implementation clones servlets to service
multiple requests; <%! int a; %> will get cloned since it belongs to the object,
but local variable <%int a; %> will not.

<!-- --> is an HTML comment.  This gets outputted to the response page "as is" by
the JSP engine.  The browser will recognize this as a comment and not display it to
the user; however, the user can view the page's source and read the comment.  <%--
--%> is a JSP comment, and is completely ignored by the JSP engine and is not sent
to the response page; hence, the user will never see it, even if the page's source
is "viewed."

<%= is equivalent to out.print().  Therefore <%== %> translates to out.print(=)
which will give a JSP compiler error.

--
Michael Hu, Paradox Team, Corel Corporation

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to