什么是使用Ant precompile JSP中的最佳方式 [英] What is the best way to precompile JSPs using ANT

查看:157
本文介绍了什么是使用Ant precompile JSP中的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出使用Ant将部署到Oracle应用服务器precompile JSP中的最佳途径。即使我部署到Oracle应用服务器,我想避免使用Oracle的ANT版本。

I am trying to figure out the best way to use ANT to precompile JSPs that will be deployed to an Oracle application server. Even though I am deploying to an Oracle app server I would like to avoid using Oracle's version of ANT.

推荐答案

Oracle的JSP编译器在你安装OC4J在ORACLE_HOME可用/ J2EE /家庭/ JSP /斌/ ojspc

Oracle's JSP compiler is available in your oc4j install at ORACLE_HOME/j2ee/home/jsp/bin/ojspc

假设你的类路径是在COMPAND线你可以运行正确的:

Assuming your classpath is correct at the compand line you would run:

ojspc your.war

ojspc your.war

战争将得到更新并放置一个罐子中包含pre-编译的JSP的WEB-INF / lib目录下。请注意,如果你的pre-编译JSP,你也应该设置MAIN_MODE为JUSTRUN来获得pre-编译JSP中的额外的性能优势。该JUSTRUN设置做什么这意味着,OC4J容器将不再检查更新.jsp文件。

The war will get updated and place a jar in the WEB-INF/lib containing the pre-compiled JSPs. Note that if your pre-compiling JSPs you should also set the MAIN_MODE to 'JUSTRUN' to get the additional performance benefit of pre-compiling your JSPs. The JUSTRUN setting does what it implies, the OC4J container will no longer check for updated .jsp files.

<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>oracle.jsp.runtimev2.JspServlet</servlet-class>
    <init-param>
      <param-name>main_mode</param-name>
      <param-value>justrun</param-value>
    </init-param>
</servlet>

在您的舒适与从命令行调用ojspc你就可以开始使用Oracle提供的Ant任务。

Once your comfortable with calling ojspc from the command line You can then begin to use the ANT tasks provided by Oracle.

在ANT

<oracle:compileJsp file="dist/war/before-${app}war"
        verbose="false"
        output="dist/war/${app}.war" />

您的项目标签应该引用神谕任务:

<project name="your-name" default="compile" basedir="."  xmlns:oracle="antlib:oracle">
...
</project>

更新2011年2月22日
你也可以直接与ojspc罐子工作,避免试图配置Oracle:compileJsp任务中,code以下需要一个war文件和pre-编译JSPS它

Update 02.22.2011 You can also just work with the ojspc jar directly and avoid trying to configure the oracle:compileJsp Task, the code below takes a war file and pre-compiles the JSPS in it.

 <!-- Now Precompile the War File (see entry in <project> tag ) -->
    <java jar="${env.ORACLE_HOME}/j2ee/home/ojspc.jar" classpathref="jspPreCompileClassPath" fork="true">
        <arg value="-addClasspath"/>
        <arg pathref="classpath"/>
        <arg line="'${dist}/war/a-war-file.war'"/>
    </java>

在JSP preCompileClassPath defnition看起来是这样的:

the jspPreCompileClassPath defnition looks like this:

  <path id="jspPreCompileClassPath">
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/pcl.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/ojsp.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/oc4j-internal.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/servlet.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/commons-el.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/bcel.jar"/>
    <path location="${env.ORACLE_HOME}/lib/xmlparserv2.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/lib/oc4j-schemas.jar"/>
    <path location="${env.ORACLE_HOME}/j2ee/home/jsp/lib/taglib/ojsputil.jar"/>
  </path>

这篇关于什么是使用Ant precompile JSP中的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆