The difference between <%!%> and <%%>

Source: Internet
Author: User

JspThe file needs to be converted intoJavaClass. On the accessJspFiles are not executed directlyJspFileBut to performJspFile corresponds to theJavaClass(classFile)The object, thisJavaFiles are provided by the server according to ourOfJspFiles created by the. InTomcat installation directory wor K jsp java

index.jsp

<%@ Page Language="Java"ContentType="text/html; charset=gb18030"pageencoding="GB18030"%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=gb18030"><title>Welcome page</title></Head><Body><%!intHitnumber=1; %><%intJubu=1; %></Body></HTML>

The corresponding Java class:

Index_jsp.java

/** Generated by the Jasper component of Apache Tomcat * Version:apache tomcat/8.0.3 * Generated at:2015-05-06 06:16:       UTC * Note:the Last modified time of this file is set to * the last modified time of the source file after * Generation to assist with modification tracking. */ Packageorg.apache.jsp;Importjavax.servlet.*;Importjavax.servlet.http.*;Importjavax.servlet.jsp.*; Public Final classxixihaha_jspextendsOrg.apache.jasper.runtime.HttpJspBaseImplementsorg.apache.jasper.runtime.JspSourceDependent { int hitnumber=1;    Private Static FinalJavax.servlet.jsp.JspFactory _jspxfactory =javax.servlet.jsp.JspFactory.getDefaultFactory (); Private StaticJava.util.map<java.lang.string,java.lang.long>_jspx_dependants; Privatejavax.el.ExpressionFactory _el_expressionfactory; PrivateOrg.apache.tomcat.InstanceManager _jsp_instancemanager;  PublicJava.util.map<java.lang.string,java.lang.long>getdependants () {return_jspx_dependants; }   Public void_jspinit () {_el_expressionfactory=_jspxfactory.getjspapplicationcontext (Getservletconfig (). Getservletcontext ()). Getexpressionfactory (); _jsp_instancemanager=Org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager (Getservletconfig ()); }   Public void_jspdestroy () {} Public void_jspservice (FinalJavax.servlet.http.HttpServletRequest request,Finaljavax.servlet.http.HttpServletResponse Response)throwsjava.io.IOException, javax.servlet.ServletException {FinalJavax.servlet.jsp.PageContext PageContext; Javax.servlet.http.HttpSession Session=NULL; Finaljavax.servlet.ServletContext Application; Finaljavax.servlet.ServletConfig config; Javax.servlet.jsp.JspWriter out=NULL; FinalJava.lang.Object page = This; Javax.servlet.jsp.JspWriter _jspx_out=NULL; Javax.servlet.jsp.PageContext _jspx_page_context=NULL; Try{Response.setcontenttype ("Text/html; charset=gb18030 "); PageContext= _jspxfactory.getpagecontext ( This, request, response,NULL,true, 8192,true); _jspx_page_context=PageContext; Application=Pagecontext.getservletcontext (); Config=Pagecontext.getservletconfig (); Session=pagecontext.getsession (); out=pagecontext.getout (); _jspx_out=Out ; Out.write ("\ r \ n"); Out.write ("<! DOCTYPE HTML public \ "-//W3C//DTD HTML 4.01 transitional//en\" \ "http://www.w3.org/tr/html4/loose.dtd\" >\r\n "); Out.write ("); Out.write ("); Out.write ("<meta http-equiv=\" content-type\ "content=\" text/html; Charset=gb18030\ ">\r\n"); Out.write ("<title> Welcome page </title>\r\n"); Out.write ("); Out.write ("<body>\r\n"); Out.write (' \ r '); Out.write (' \ n '); int jubu=1;  Out.write ("\ r \ n"); Out.write ("</body>\r\n"); Out.write ("); } Catch(Java.lang.Throwable t) {if(! (tinstanceofjavax.servlet.jsp.SkipPageException)) { out=_jspx_out; if(Out! =NULL&& out.getbuffersize ()! = 0)          Try{Out.clearbuffer ();}Catch(Java.io.IOException e) {}if(_jspx_page_context! =NULL) _jspx_page_context.handlepageexception (t); Else Throw Newservletexception (t); }    } finally{_jspxfactory.releasepagecontext (_jspx_page_context); }  }}

The difference between <%!%> and <%%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.