Hello,

My question regards how JSPs become servlets. Let's say you have a JSP page
like this:

<html>
<%
    someMethod();
%>

<%!
    public void  someMethod()
    {
%>
    A chuck of html.<br>
<%!
    }
%>
</html>

I ran this under Tomcat. It produced this HTML page:

<html>



 A chunk of HTML.<br>


</html>

This struck me as strange. My understanding is that all code between
scriptlet tags (<% %>) becomes part of the _jspService() method definition,
and so it has access to the implicit JspWriter "out" object.

But according to the JSP 1.1 spec (section 2.10.1), the method within the
declaration tags (that is, <%! %>) doesn't produce output to the "out"
object. So if that's true, how come this code works? Am I wrong in assuming
that all HTML in a JSP page gets streamed out the JspWriter "out" object?

I looked at the servlet that Tomcat generated for this JSP, because I was
curious about how someMethod() was implemented in the servlet Tomcat
produced. What I found left me even more puzzled:

public void someMethod()
{
    // end
    // begin
[file="/usr/local/jakarta/jakarta-tomcat-3.2.1/webapps/stest/mydemo.jsp";fro
m=(17,3);to=(19,0)]

}

Can anyone explain this? I found no mention of this "// begin" statement in
the servlet or JSP specs, nor in any manuals. Is this Tomcat-specific? Any
help is appreciated.
--
Jason Wells
Web Architect
Xsilogy, Inc.
http://www.xsilogy.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to