BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / java / #15551同步于 2010/8/24
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖

请教大牛关于JSP预编译的问题

air8898
2010/8/24镜像同步1 回复
用ant 运行下面的编译,可以将jsp编译为.java,然后再编译为.class,可是运行时会因为jsp页面等代码的错误而停止,大家有什么好的方法 ========================================================= <?xml version= "1.0 " encoding= "iso-8859-1 "?> <project name= "tomcat precompile " default= "dist " basedir= ". "> <property name= "tomcat.home " location= "D:\Tomcat "/> <property name= "ant " location= "D:\Program Files\ant1.5 "/> <property name= "libpath " location= "E:\JSPPrecompile\lib "/> <property name= "webapp.name " value= "ischool " /> <property name= "webapp.path " location= "${tomcat.home}/webapps/${webapp.name} "/> <target name= "jspc "> <taskdef classname= "org.apache.jasper.JspC " name= "jasper2 " > <classpath id= "jspc.classpath "> <pathelement location= "${java.home}/../lib/tools.jar "/> <fileset dir= "${tomcat.home}/server/lib "> <include name= "*.jar "/> </fileset> <fileset dir= "${tomcat.home}/common/lib "> <include name= "*.jar "/> </fileset> </classpath> </taskdef> <taskdef name= "foreach " classname= "net.sf.antcontrib.logic.ForEach " classpath= "${ant}/ant-contrib.jar " /> <jasper2 validateXml= "false " uriroot= "${webapp.path} " webXmlFragment= "${webapp.path}/WEB-INF/generated_web.xml " outputDir= "${webapp.path}/WEB-INF/src " package= "some.unique.string.asd34sad "> </jasper2> <replaceregexp match= "^package some.unique.string.asd34sad.*; " replace= "package org.apache.jsp; " byline= "true "> <fileset dir= "${webapp.path}/WEB-INF/src "> <include name= "**/*.* "/> </fileset> </replaceregexp> <echo> Compiling generated classes from JSPC </echo> <foreach target= "do-jsp-compile " param= "dir-path "> <path> <dirset dir= "${webapp.path}/WEB-INF/src "/> </path> </foreach> <move todir= "${tomcat.home}/work/Standalone/localhost/${webapp.name} "> <fileset dir= "${webapp.path}/WEB-INF/src "> <include name= "**/*.* "/> </fileset> </move> </target> <target name= "do-jsp-compile "> <echo> Compile JSP in: ${dir-path} </echo> <javac destdir= "${dir-path} " optimize= "off " debug= "on " failonerror= "false " srcdir= "${dir-path} " > <classpath> <pathelement location= "${webapp.path}/WEB-INF/classes "/> <fileset dir= "${webapp.path}/WEB-INF/lib "> <include name= "*.jar "/> </fileset> <pathelement location= "${tomcat.home}/common/classes "/> <fileset dir= "${tomcat.home}/common/lib "> <include name= "*.jar "/> </fileset> <pathelement location= "${tomcat.home}/shared/classes "/> <fileset dir= "${tomcat.home}/server/lib "> <include name= "*.jar "/> </fileset> </classpath> <include name= "*.java " /> </javac> <mkdir dir= "${dir-path}/org/apache/jsp "/> <move todir= "${dir-path} " failonerror= "false "> <fileset dir= "${dir-path}/org/apache/jsp "> <include name= "*.* "/> </fileset> </move> <delete dir= "${dir-path}/org " failonerror= "false "/> </target> <target name= "dist " depends= "jspc " > </target> </project>
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复
ericyosho机器人#1 · 2010/8/24
去修改jsp错误呗。修改完了,就编译通过了。