首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

jetty实战二-jsp

2013-11-09 
jetty实战2-jsp1.概述jetty会将jsp文件编译成servlet然后提供服务,主要原理是在webdefault.xml中,有一个关

jetty实战2-jsp
1.概述

jetty会将jsp文件编译成servlet然后提供服务,主要原理是在webdefault.xml中,有一个关于jsp的配置

?

jetty用的的jsp-2.1-glassfish的核心类图如下:

?

?
jetty实战二-jsp
?2.编译2.1 编译过程

?

编译的逻辑是(jsp2.1.6.jar),在每次请求JspServlet的service方法中,主要调用

?

    private void initJavaCompiler() {        Class c = getClassFor("javax.tools.ToolProvider");        if (c != null) {            // JDK1.6            c = getClassFor("org.apache.jasper.compiler.Jsr199JavaCompiler");            if (c != null) {                try {                    javaCompiler = (JavaCompiler) c.newInstance();                } catch (Exception ex) {                }            }        }        if (javaCompiler == null) {            c = getClassFor("org.eclipse.jdt.internal.compiler.Compiler");            if (c != null) {                c = getClassFor("org.apache.jasper.compiler.JDTJavaCompiler");                if (c != null) {                    try {                        javaCompiler = (JavaCompiler) c.newInstance();                    } catch (Exception ex) {                    }                }            }        }        if (javaCompiler == null) {            javaCompiler = new AntJavaCompiler();        }        javaCompiler.init(ctxt, errDispatcher, jspcMode);    }

??

4.参考文档

1. http://wiki.eclipse.org/Jetty/Howto/Configure_JSP

?

热点排行
Bad Request.