jagtool commands  configure

Chapter 12: Using jagtool and jagant

compilejsp

Description

Compiles JSP files.

Syntax

Local mode support: Yes.

Connected mode support: No.

Command line:

compilejsp 
local-args 
[-webapp WebAppName] 
[-uriroot directory] 
[-outputdir directory] 
[-verbose true|false] 
[-debug true|false] 
[-keep true|false] 
[-force true|false] 
[-servername server]
[file1 file2 ...]

Ant build file:

<jag_compilejsp
[ webapp="WebAppName" ]
[ uriroot="directory" ]
[ outputdir="directory" ]
[ verbose="true|false" ]
[ debug="true|false" ]
[ keep="true|false" ]
[ force="true|false" ]
[ servername=”server” ]
[ jspfile=”file” ] />

Option

Description

Required

local-args

Arguments to run in local mode. See “Using local mode”.

Yes

webapp

Compiles the JSP files in the specified Web application. Uses the JAGUAR environment variable to locate the Web application directory. Compiles all JSP files in the Web application unless specific files are specified.

You must specify one of the -webapp or -uriroot options, but not both.

You must specify the -webapp option to compile JSPs that require tag library mappings defined in the Web application properties file.

No

uriroot

Compiles the specified JSP files in the given directory, which must be specified as a complete path. If no files are specified, compiles all JSP files in the directory and its subdirectories.

No

outputdir

The full path of the output directory for generated Java source and compiled classes. If the -webapp option is specified, the default is this subdirectory of your EAServer installation directory:

work\server\Servlet\WebApp-WAName

Where server is the name of your server, and WAName is the name of your Web application. To run the JSPs in EAServer, class files must be in this directory.

If the -webapp option is not specified, the default is the current directory.

No

verbose

Execute in verbose mode. The default is false.

No

debug

Compile the generated Java files with debugging information. The default is false.

No

keep

Keep the generated Java source files rather than deleting them. The default is true.

No

force

Force compilation of JSP files, regardless of whether the class file is newer than the JSP source file. The default is true.

No

servername

The server for which the JSP should be compiled. The default is Jaguar.

No

file1 file2 ...

When using the command line, the list of files to compile, with paths specified relative to the Web application root directory, if using the webapp option, or the specified directory, if using the uriroot option. If no files are specified, all files in the specified Web application or directory are compiled.

No

jspfile

When using Ant, the file to compile with path relative to the relative to the Web application root directory, if using the webapp option, or the specified directory, if using the uriroot option. If no file is specified, all files in the specified Web application or directory are compiled.

No

Returns

Return value

Indicates

0

The command ran successfully; the result is true/success.

2

The command did not run successfully; an exception was thrown.

Examples

Example 1

This command line example compiles the files jsp/file1.jsp and jsp/file2.jsp in the Web application MyWebApp:

jagtool compilejsp -webapp MyWebApp jsp/file1.jsp jsp/file2.jsp

The output goes to the EAServer directory:

work/server/Servlet/WebApp-MyWebApp

Example 2

This command line example recursively compiles all JSPs in the Web application MyWebApp:

jagtool compilejsp -webapp MyWebApp

The output goes to the EAServer directory:

$JAGUAR/work/server/Servlet/WebApp-MyWebApp

Where server is the name of the server you are connected to.

Example 3

This command line example compiles file1.jsp in the Web application MyWebApp:

jagtool compilejsp -webapp MyWebApp -outputdir c:\temp file1.jsp

The output goes to c:\temp.

Example 4

This command line example compiles file1.jsp in the directory c:\webapps\MyWebAppDir:

jagtool compilejsp -uriroot c:\webapps\MyWebAppDir file1.jsp

The output goes to the current directory.

Example 5

This command line example recursively compiles all JSPs in the directory c:\webapps\MyWebAppDir:

jagtool compilejsp -uriroot c:\webapps\MyWebAppDir -outputdir c:\temp

The output goes to c:\temp.

Example 6

This Ant build file example defines a target to compile two JSP files:

<target name="compilejsp_test" >
  <jag_compilejsp Jspfile="file1.jsp" verbose="false" Uriroot="D:\EAS\Sample\jagtool" />
  <jag_compilejsp Jspfile="file2.jsp" verbose="false" Uriroot="D:\EAS\Sample\jagtool" />
</target>

Usage

You must run compilejsp in local mode. If running jagtool, see “Using local mode”. If running jagant, see “Using jagant in local mode”.

To use the compilejsp command in Ant, you must add the location of the xalan.jar and crimson.jar files that are included with EAServer to the Ant CLASSPATH. See “Setting up your environment” for more information.

You can also compile JSPs with the EAServer jspc script. The jspc script invokes jagtool to compile JSPs.

See also

Chapter 24, “Creating JavaServer Pages,” in the EAServer Programmer’s Guide





Copyright © 2005. Sybase Inc. All rights reserved. configure