Compiling JSPs Using the Command-Line Compiler---官方
Web Server provides the following ways of compiling JSP 2.1-compliant source files into servlets:
JSP are automatically compiled at runtime.
The jspc command-line tool, described in this section, enables you to precompile JSPs at the command line.
You must disable dynamic reloading of JSP when deploying a web application archive that has precompiled JSP without the correspondingjsp source files. To do this, set the reload-interval property to -1 in the jsp-config element of the sun-web.xml file. For more information, see JSP Element.
The jspc command-line tool is located under install_dir/bin. The format of the jspc command is as follows:
jspc [options] file_specifier
The following table shows what file_specifier can contain in the jspc command.
Table 5–1 File Specifiers for the jspc Command
File Specifier |
Description |
---|---|
files |
One or more JSP files to be compiled. |
-webappdir |
A directory containing a web application. All JSPs in the directory and its subdirectories are compiled. You cannot specify a WAR, JAR, or ZIP file. You must first extract such files to an open directory structure. |
The following table shows the basic options for the jspc command.
Table 5–2 Basic jspc Options
Option |
Description |
---|---|
-help |
Enables quiet mode (same as -v0). Only fatal error messages are displayed. |
-v |
Verbose mode. |
-d dir |
Specifies the output directory for the compiled JSPs. Package directories are automatically generated based on the directories containing the uncompiled JSPs. The default top-level directory is the directory from which jspc is invoked. |
-l |
Specifies the name of the JSP on failure. |
-s |
Specifies the name of the JSP on success. |
-p name |
Specifies the name of the target package for all specified JSPs, overriding the default package generation performed by the -d option. |
-c name |
Specifies the target class name of the first JSP compiled. Subsequent JSPs are unaffected. |
-mapped |
Generates separate write() calls for each HTML line in the JSP. |
die(#) |
Generates an error return code (#) on fatal errors (default 1). |
-uribase dir |
Specifies the URI directory to which compilations are relative. Applies only to explicitly declared JSP files. This path is the location of each JSP file relative to the uriroot. If this location cannot be determined, the default is /. |
-uriroot dir |
A directory containing a web application. All JSPs in the directory and its subdirectories are compiled. You cannot specify a WAR, JAR, or ZIP file. You must first extract such files to an open directory structure. |
-compile |
Compiles the generated servlets. |
-genclass |
Generates class files in addition to Java files. |
-webinc file |
Creates a partial servlet mappings in the file. |
-web.xml file |
Creates a complete web.xml structure in the file. |
-ieplugin clsid |
Java Plug-in classid for Internet Explorer. |
classpath path |
Overrides the java.class.path system property |
xpoweredBy |
Add the X-Powered-By response header. |
-trimSpaces |
Trims spaces in text templates between actions and directives. |
-smap |
Generates SMAP info for JSR 45 debugging. |
-dumpsmap |
Dumps SMAP info for JSR45 debugging into a file. |
-compilerSourceVMrelease |
Provides source compatibility with specified JDKTM release. |
-compilerTargetVMrelease |
Generates class files for specified VM version. |
For example, this command compiles the hello JSP file and writes the compiled JSP under hellodir:
jspc -d hellodir -genclass hello.jsp
This command compiles all of the JSP files in the web application under webappdir into class files under jspclassdir:
jspc -d jspclassdir -genclass -webapp webappdir
To use either of these precompiled JSPs in a web application, put the classes under hellodir or jspclassdir into a JAR file, place the JAR file under WEB-INF/lib, and set the reload-interval property to -1 in the sun-web.xml file.
Package Names Generated by the JSP Compiler
When a JSP is compiled, a package is created for it. The package name starts with jspc. For example, the generated package name for~/SOURCE/JSP/myjsps/hello.jsp is precompiled as jspc -webapp ~/SOURCE -d ~/test1/test2/test3. The generated servlet is located in ~/test1/test2/test3/org/apache/jsp/JSP/myjsps/hello_jsp.java and defined in org.apache.jsp.JSP.myjsps. The path for hello.jsp is derived from the directory in which the JSP is located.
In another example, the same hello.jsp is precompiled using the —p option, and is precompiled as jspc -webapp ~/SOURCE -d ~/test1/test2/test3 -p app1.app2.app3. The generated servlet is located in~/test1/test2/test3/app1/app2/app3/JSP/myjsps/hello_jsp.java and defined inside package app1.app2.app3.JSP.myjsps. Note that the package specified with the -p option (app1.app2.app3) overrides the standard org.apache.jsp but does not affect the package derived from the directory in which the JSP is located. Also, note that the -d option does not affect on the generated package name.
Other JSP Configuration Parameters
For information about the various JSP configuration parameters you can use, see the section jsp-config Element. The JSP compiler uses the default values for parameters that are not included in the file.
原文地址:https://docs.oracle.com/cd/E19146-01/821-0790/abxcc/index.html
Compiling JSPs Using the Command-Line Compiler---官方的更多相关文章
- List of Chromium Command Line Switches(命令行开关集)——官方指定命令行更新网址
转自:http://peter.sh/experiments/chromium-command-line-switches/ There are lots of command lines which ...
- IAR Build from the command line 环境变量设置
http://supp.iar.com/Support/?Note=47884 Technical Note 47884 Build from the command line The alterna ...
- Data Science at the Command Line学习笔记(一)
学习Data Science at the Command Line时,win7下安装环境是遇到了一些小问题,最后通过百度解决. 官方指导可以在这个地址找到:http://datascienceatt ...
- Building QT projects from the command line
/************************************************************************ * Building QT projects fro ...
- Centos下_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.
在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...
- Xcode 8.X Command Line Tools
Summary Step 1. Upgrade Your System to macOS Sierra Step 2. Open the Terminal Application Step 3. Is ...
- 数据库备份出现警告:Warning: Using a password on the command line interface can be insecure. Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even thos
1.先来看原备份数据库语句: mysqldump -h 127.0.0.1 -uroot -ppassword database > /usr/microStorage/dbbackup/cap ...
- How to deploy a Delphi OSX project from the command line
Delphi has a well developed command line build process (via MSBuild) for Windows projects. After the ...
- MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.
在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...
随机推荐
- iOS: 布局可视化语法 Visual Format Syntax
可视化语法 Visual Format Syntax The following are examples of constraints you can specify using the visua ...
- 学习Swift -- 析构过程
析构过程 析构器只适用于类类型,当一个类的实例被释放之前,析构器会被立即调用.析构器用关键字deinit来标示,类似于构造器要用init来标示. 原理 Swift 会自动释放不再需要的实例以释放资源, ...
- seajs的spm使用
压缩JS文件 只需要执行这个命令即可 spm build xxx.js 这时候你将得到一个压缩过的__build/xxx.js文件 合并JS文件 如果希望将JS文件中require的其他模块都合并到这 ...
- javascript学习代码-判断闰年
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- BZOJ 3676 回文串
Description 考虑一个只包含小写拉丁字母的字符串\(s\).我们定义\(s\)的一个子串\(t\)的"出现值"为\(t\)在\(s\)中的出现次数乘以\(t\)的长度.请 ...
- servlet监听器实现在线人数统计
一.准备知识 servlet:servlet是一种运行服务器端的java应用程序,具有独立于平台和协议的特性,并且可以动态的生成web页面,它工作在客户端请求与服务器响应的中间层. filter:fi ...
- 【HDU3341】 Lost's revenge (AC自动机+状压DP)
Lost's revenge Time Limit: 5000MS Memory Limit: 65535KB 64bit IO Format: %I64d & %I64u Descripti ...
- bzoj2729
一看就知道是数学题,考虑插空法由于老师只有两人,所以先对老师进行插空这里考虑两种情况:1.两个老师站在同一处,即两个男生之间站了两个老师这时候需要一个女生站在两个老师之间,再对女生插空,根据乘法原理即 ...
- Node.js权威指南 (6) - 在Node.js中操作文件系统
6.1 同步方法与异步方法 / 856.2 对文件执行读写操作 / 86 6.2.1 文件的完整读写 / 86 6.2.2 从指定位置处开始读写文件 / 916.3 创建与读取目录 / 97 6.3. ...
- @repository注解
Spring的注解形式:@Repository.@Service.@Controller,它们分别对应存储层Bean,业务层Bean,和展示层Bean. @Repository.@Service.@C ...