Convert JSP to Java

Source: Internet
Author: User
When testing the JSP program today, I want to see what the Java code translated by the server into JSP looks like. So I searched in the glassfish directory and found the translated Java code as follows:

Package org. Apache. jsp;

Import javax. servlet .*;
Import javax. servlet. http .*;
Import javax. servlet. jsp .*;
Import java. util .*;

Public final class testjsp_jsp extends org. Apache. Jasper. runtime. httpjspbase
Implements org. Apache. Jasper. runtime. jspsourcedependent {

Private Static final jspfactory _ jspxfactory = jspfactory. getdefafactory Factory ();

Private Static java. util. Vector _ jspx_dependants;

Private org. Apache. Jasper. runtime. resourceinjector _ jspx_resourceinjector;

Public object getdependants (){
Return _ jspx_dependants;
}

Public void _ jspservice (httpservletrequest request, httpservletresponse response)
Throws java. Io. ioexception, servletexception {

Pagecontext = NULL;
Httpsession session = NULL;
Servletcontext application = NULL;
Servletconfig Config = NULL;
Jspwriter out = NULL;
Object page = this;
Jspwriter _ jspx_out = NULL;
Pagecontext _ jspx_page_context = NULL;

Try {
Response. setcontenttype ("text/html; charset = gb18030 ");
Response. setheader ("X-powered-by", "JSPs/2.1 ");
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;
_ Jspx_resourceinjector = (Org. Apache. Jasper. runtime. resourceinjector) application. getattribute ("com. Sun. appserv. jsp. Resource. injector ");

Out. Write ("/R/N ");
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 ("<HTML>/R/N ");
Out. Write ("Out. Write ("<meta http-equiv =/" Content-Type/"content =/" text/html; charset = gb18030/">/R/N ");
Out. Write ("<title> insert title here </title>/R/N ");
Out. Write ("Out. Write ("<body>/R/N ");

Calendar curtime = new gregoriancalendar ();
Int H = curtime. Get (curtime. hour_of_day );
Out. println (h );

Out. Write ("/R/N ");
Out. Write ("</body>/R/N ");
Out. Write ("} Catch (throwable t ){
If (! (T instanceof skippageexception )){
Out = _ jspx_out;
If (OUT! = NULL & out. getbuffersize ()! = 0)
Out. clearbuffer ();
If (_ jspx_page_context! = NULL) _ jspx_page_context.handlepageexception (t );
}
} Finally {
_ Jspxfactory. releasepagecontext (_ jspx_page_context );
}
}
}

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.