com.ibm.websphere.ant.tasks

Class JspC

  • java.lang.Object
    • org.apache.tools.ant.ProjectComponent
      • org.apache.tools.ant.Task
        • com.ibm.websphere.ant.tasks.JspC
  • All Implemented Interfaces:
    java.lang.Cloneable


    public class JspC
    extends org.apache.tools.ant.Task
    The JspC task compiles JSP files into .class files.

    JspC is included in WebSphere Application Server and is found in the jar wsanttasks.jar.
    JspC is an Ant front-end to the WebSphere JSP Batch Compiler. Descriptions of the attributes can be found in the Infocenter, and in the file batchcompiler.properties.default in {WAS_ROOT}/bin.

    Below is an example of a build script with multiple targets, each with different attributes.         
    The following commands can be used to execute the script:                                            
          On Windows: ant -Dwas.home=%WAS_HOME% -Dear.path=%EAR_PATH% -Dextract.dir=%EXTRACT_DIR%          
                      ant jspc2 -Dwas.home=%WAS_HOME% -Dapp.name=%APP_NAME% -Dwebmodule.name=%MOD_NAME%    
                      ant jspc3 -Dwas.home=%WAS_HOME% -Dapp.name=%APP_NAME% -Dwebmodule.name=%MOD_NAME% -Ddir.name=%DIR_NAME%   
          On Unix:    ant -Dwas.home=$WAS_HOME  -Dear.path=$EAR_PATH  -Dextract.dir=$EXTRACT_DIR           
                      ant jspc2 -Dwas.home=$WAS_HOME -Dapp.name=$APP_NAME -Dwebmodule.name=$MOD_NAME       
                      ant jspc3 -Dwas.home=$WAS_HOME -Dapp.name=$APP_NAME -Dwebmodule.name=$MOD_NAME -Ddir.name=$DIR_NAME   
     

    <project name="JSP Precompile" default="jspc1" basedir="."> <taskdef name="wsjspc" classname="com.ibm.websphere.ant.tasks.JspC"/> <target name="jspc1" description="example using a path to an EAR, and extracting the EAR to a directory"> <wsjspc wasHome="${was.home}" earpath="${ear.path}" forcecompilation="true" extractToDir="${extract.dir}" useThreadTagPool="true" keepgenerated="true" jspCompileClasspath="" /> </target> <target name="jspc2" description="example using an enterprise app and webmodule"> <wsjspc wasHome="${was.home}" enterpriseAppName="${app.name}" webmoduleName="${webmodule.name}" removeTempDir="true" forcecompilation="true" keepgenerated="true" jspCompileClasspath="" /> </target> <target name="jspc3" description="example using an enterprise app, webmodule and specific directory"> <wsjspc wasHome="${was.home}" enterpriseAppName="${app.name}" webmoduleName="${webmodule.name}" fileName="${dir.name}" recurse="false" forcecompilation="true" keepgenerated="true" jspCompileClasspath="" /> </target> </project> The attributes of the JspC task are shown below: <wsJspC earPath="full path to single compressed or expanded enterprise application archive" warPath="full path to single compressed or expanded web application archive" src="same as warPath - for backward compatibility" enterpriseAppName="name of a deployed Enterprise Application" responseFile="a file that contains pararmeters to be used by the Batch Compiler" webmoduleName="name of a single webmodule within an EAR or Enterprise Application" fileName="a single JSP filename or directory name within a Web Module" recurse="specifies whether a directory named in the fileName attribute should be recursed" configRoot="location of the WebSphere configuration directory" cellName="cell name where the requested Enterprise Application is installed" nodeName="node name where the requested Enterprise Application is installed" serverName="server name where the requested Enterprise Application is installed" profileName="name of the profile in which the requested Enterprise Application is installed" translate="when false, JSPs will not be translated and compiled. Used only in conjunction with removeTempDir" compile="when false, JSPs will only be syntax-checked and translated and not compiled" removeTempDir="specify whether a web module's temp directory should be removed. Can only be used when enterpriseApp is given" extractToDir="directory into which predeployed EARs and WARs will be extracted before compilation is performed" compileToWebInf="the target directory for the compiled JSP classfiles should be the Web Module's WEB-INF/classes directory instead of the WAS temp directory" compileToDir="directory into which JSPs will be translated into Java sourcefiles and compiled into classfiles" toDir="same as compileToDir - for backward compatibility" forceCompilation="all JSP resources will be compiled even if a JSP is not outdated" useFullPackageNames="generate full package names for JSP classes" trackDependencies="a JSP will be compiled if any of its dependencies have changed, even if the JSP itself has not changed" createDebugClassfiles="the Java class files generated by the JSP compiler should be compiled to generate all debugging info" keepgenerated="the Java files generated by the JSP compiler during the translation phase of the processing should be kept" keepGeneratedclassfiles="the class files generated by the JSP compiler during the translation phase of the processing should be kept" usePageTagPool="Enables or disables the reuse of custom tag handlers on an individual JavaServer Page basis" useThreadTagPool="Enables or disables the reuse of custom tag handlers on a per request thread basis per Web Application Archive (WAR)" classloaderParentFirst="Search order for loading classes. Default is to search parent classloader prior to application classloader" classloaderSingleWarClassloader="Specify whether to use one classloader per Enterprise Application Archive (EAR) or one classloader per Web Application Archive (WAR)" additionalClasspath="additional classpath entries to be used when parsing and compiling JSP pages" classpath="same as additionalClasspath - for backward compatibility" jspCompileClasspath="instructs JSP engine to use a small classpath for the java compilation phase" verbose="Specify whether to output messages about what the compiler is doing when the JSP is compiled" deprecation="Specify whether deprecation warnings should be emitted when the JSP is compiled" javaEncoding="Specify the encoding that will be used by the Java compiler when it writes the generated .java file." compilerOptions="Specify a list of strings to be passed on the java compiler command. This is a space-separated list of the form arg1 arg2 argn" compileWithAssert="Specify whether the generated java classes should contain support for JDK 1.4 Assertions" jdkSourceLevel="Specify the source level for the java compiler" useJikes="Specify whether Jikes should be used for compiling Java sources" useJDKCompiler="Specify whether the JDK compiler should be used for compiling Java sources. The default is to use the JDT compiler." useRepeatInt="The 'index' attribute of the tsx:repeat tag in version 6.0 is java.lang.Integer. Set this flag to true if your JSPs use the primitive integer (int) for this attribute." allowJspOutputElementMismatch="In the jsp:output element, multiple occurrences of the doctype-root-element , doctype-system or doctype-public properties should cause an translation error if the values for the properties differ from the previous occurence. The default behavior of WAS is to raise a translation error. Set this flag to true to tell WAS to NOT raise a translation error under these conditions." allowTaglibPrefixRedefinition="If a taglibrary prefix was already defined with a different URI within a JSP, WAS will raise a translation error. Set this flag to true to tell WAS to NOT raise a translation error under these conditions." allowTaglibPrefixUseBeforeDefinition="If a taglibrary prefix is used before the tag directive that defines the prefix, WAS will raise a translation error. Set this flag to true to tell WAS to NOT raise a translation error under these conditions." allowUnmatchedEndTag="In WebSphere version 5, improper termination of end tags was ignored while in WebSphere V6 a translation exception is thrown. Set this flag to true to tell WAS to NOT raise a translation error under these conditions." useIterationEval="In WebSphere version 5,the loop conditions for custom tags were evaluates based on the condition criteria in the loop condition, while in v6 this was changed. Set this flag to true to tell WAS to base iterations on the criteria in the loop condition useScriptVarDupInit="In version 5, WAS declared a tag variable each time it was encountered within a scriptlet If-Else condition, even if the variable had a 'page' scope. Version 6 correctly does not do this. For backward compatibility, set this attribute to true." useCDataTrim="Enables or disables the trimming of whitespaces before a CDATA section is created" disableURLEncodingForParamTag="Enables or disables the encoding of jsp params in jsp:param tag by page authors" jspFileExtensions="Specify the file extensions to be processed by the batch compiler. This is a semicolon- or colon-separated list of the form *.ext1;*.ext2:*.extn" logLevel="Specify the level of logging that will be directed to the console during batch compilation" wasHome="websphere install directory" classpathref="ear classes reference element name" jvmMaxMemory="256M" fileEncoding="UTF8" /> ******** One and only one of the following four attributes is required ******
    The earPath attribute is the full path to single compressed or expanded enterprise application archive
    The warPath attribute is the full path to single compressed or expanded web application archive
    The src attribute is the same as warPath - for backward compatibility
    The enterpriseAppName attribute is the name of a deployed Enterprise Application
    ******** Optional attributes ******
    The responseFile attribute specifies a file that contains pararmeters to be used by the Batch Compiler
    The webmoduleName attribute is the name of a single webmodule within an EAR or Enterprise Application
    The fileName attribute is a single JSP filename or directory name within a Web Module
    The recurse attribute specifies whether a directory named in the fileName attribute should be recursed
    The configRoot attribute is the location of the WebSphere configuration directory
    The cellName attribute is the cell name where the requested Enterprise Application is installed
    The nodeName attribute is the node name where the requested Enterprise Application is installed
    The serverName attribute is the server name where the requested Enterprise Application is installed
    The profileName attribute is the name of the profile in which the requested Enterprise Application is installed
    The translate attribute, when false, indicates JSPs should not be translated and compiled. Used only in conjunction with removeTempDir
    The compile attribute, when false, indicates that JSPs will only be syntax-checked and translated, but not compiled.
    The removeTempDir attribute indicates that a web module's temp directory should be removed. Can only be used when enterpriseApp is given
    The extractToDir attribute is the directory into which predeployed EARs and WARs will be extracted before compilation is performed
    The compileToWebInf attribute is the the target directory for the compiled JSP classfiles should be the Web Module's WEB-INF/classes directory instead of the WAS temp directory
    The compileToDir attribute is the directory into which JSPs will be translated into Java sourcefiles and compiled into classfiles
    The toDir attribute is the same as compileToDir - for backward compatibility
    The forceCompilation attribute specifies that all JSP resources will be compiled even if a JSP is not outdated
    The useFullPackageNames attribute specifies that full package names will be generated for JSP classes
    The trackDependencies attribute specifies that a JSP will be compiled if any of its dependencies have changed, even if the JSP itself has not changed
    The createDebugClassfiles attribute specifies that the Java class files generated by the JSP compiler should be compiled to generate all debugging info
    The keepgenerated attribute specifies that the Java files generated by the JSP compiler during the translation phase of the processing should be kept
    The keepGeneratedclassfiles attribute specifies that the class files generated by the JSP compiler during the translation phase of the processing should be kept
    The usePageTagPool attribute enables or disables the reuse of custom tag handlers on an individual JavaServer Page basis
    The useThreadTagPool attribute enables or disables the reuse of custom tag handlers on a per request thread basis per Web Application Archive (WAR)
    The classloaderParentFirst attribute is the search order for loading classes. Default is to search parent classloader prior to application classloader
    The classloaderSingleWarClassloader attribute specifies whether to use one classloader per Enterprise Application Archive (EAR) or one classloader per Web Application Archive (WAR)
    The additionalClasspath attribute specifies additional classpath entries to be used when parsing and compiling JSP pages
    The classpath attribute specifies extra, ear classes that are needed to compile the JSPs. It is the same as additionalClasspath - for backward compatibility
    The jspCompileClasspathinstructs JSP engine to use a small classpath for the java compilation phase
    The verbose attribute specifies whether to output messages about what the compiler is doing when the JSP is compiled
    The deprecation attribute specifies whether deprecation warnings should be emitted when the JSP is compiled
    The javaEncoding attribute specifies the encoding that will be used by the Java compiler when it writes the generated .java file.
    The compilerOptions attribute specifies a list of strings to be passed on the java compiler command. This is a space-separated list of the form arg1 arg2 argn
    The compileWithAssert attribute specifies whether the generated java classes should contain support for JDK 1.4 Assertions
    The jdkSourceLevel attribute specifies the source level for the java compiler
    The useJikes attribute specifies whether Jikes should be used for compiling Java sources
    The useJDKCompiler attribute specifies whether the JDK compiler should be used for compiling Java sources
    The useRepeatInt attribute specifies whether the 'index' attribute of the tsx:repeat tag in version 6.0 should be treated as a primitive integer (int). The default in Version 6.0 is java.lang.Integer. Set this flag to true if your JSPs use int for this attribute.
    The allowJspOutputElementMismatchIn the jsp:output element, multiple occurrences of the doctype-root-element , doctype-system or doctype-public properties should cause an translation error if the values for the properties differ from the previous occurence. The default behavior of WAS is to not raise a translation error. Set this flag to false to tell WAS to raise a translation error under these conditions.
    The allowTaglibPrefixRedefinitionIf a taglibrary prefix was already defined with a different URI within a JSP, WAS will raise a translation error. Set this flag to true to tell WAS to NOT raise a translation error under these conditions.
    The allowTaglibPrefixUseBeforeDefinitionIf a taglibrary prefix is used before the tag directive that defines the prefix, WAS will raise a translation error. Set this flag to true to tell WAS to NOT raise a translation error under these conditions.
    The allowUnmatchedEndTagIn WebSphere version 5, improper termination of end tags was ignored while in WebSphere V6 a translation exception is thrown. Set this flag to true to tell WAS to NOT raise a translation error under these conditions.
    The useIterationEvalIn WebSphere version 5, loops in Iteration tags were evaluated based on loop condition criteria while in v6 condition was evaluated inside the loop which enters an infinite loop in certain scenarios.Set this flag to true to tell WAS to base the iterations similar to v5.
    The useScriptVarDupInitIn version 5, WAS declared a tag variable each time it was encountered within a scriptlet If-Else condition, even if the variable had a 'page' scope. Version 6 correctly does not do this. For backward compatibility, set this attribute to true.
    The useCDataTrim attribute enables or disables the trimming of whitespaces before creating a CData section The disableURLEncodingForParamTag attribute enables or disables jsp params encoding in jsp:param tag by page authors The jspFileExtensions attribute specifies the file extensions to be processed by the batch compiler
    The logLevel attribute specifies the level of logging that will be directed to the console during batch compilation
    The wasHome attribute contains the location of the WebSphere Installation Directory.
    The classpathref attribute is optional and does the same thing as the classpath attribute, but is specified as an Ant path reference.
    The jvmMaxMemory attribute is optional and sets maximum size of the memory for the underlying VM. Defaults to 256M
    The fileEncoding attribute is optional and sets the file.encoding System Property for the underlying VM.

    Version:
    2.0
    See Also:
    Copyright IBM Corp. 2002, 2003 Source File: JspC.java Creation Date: May 17, 2002; modified April 27, 2004
    • Constructor Detail

      • JspC

        public JspC()
        Constructor for JspC
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException
        See Also:
        Task.execute()
      • setWasHome

        public void setWasHome(java.lang.String wasHome)
        Sets the wasHome.
        Parameters:
        wasHome - The wasHome to set
      • setFailonerror

        public void setFailonerror(boolean failonerror)
        Sets the failonerror.
        Parameters:
        failonerror - The failonerror to set
      • setSrc

        public void setSrc(java.lang.String src)
        Sets the src.
        Parameters:
        src - The src to set
      • setToDir

        public void setToDir(java.lang.String toDir)
        Sets the toDir.
        Parameters:
        toDir - The toDir to set
      • createClasspath

        public org.apache.tools.ant.types.Path createClasspath()
        Maybe creates a nested classpath element.
      • setClasspathRef

        public void setClasspathRef(org.apache.tools.ant.types.Reference r)
        Adds a reference to a CLASSPATH defined elsewhere.
      • setClasspath

        public void setClasspath(org.apache.tools.ant.types.Path classpath)
        Sets the classpath
        Parameters:
        classpath - The classpath to set
      • setFork

        public void setFork(boolean fork)
        Sets the fork.
        Parameters:
        fork - The fork to set
      • getToolsJar

        protected java.lang.String getToolsJar()
      • setAdditionalClasspath

        public void setAdditionalClasspath(java.lang.String string)
        Parameters:
        string -
      • setCellName

        public void setCellName(java.lang.String string)
        Parameters:
        string -
      • setClassloaderParentFirst

        public void setClassloaderParentFirst(java.lang.String string)
        Parameters:
        string -
      • setClassloaderSingleWarClassloader

        public void setClassloaderSingleWarClassloader(java.lang.String string)
        Parameters:
        string -
      • setClasspath

        public void setClasspath(java.lang.String string)
        Parameters:
        string -
      • setCompileClasspath

        public void setCompileClasspath(org.apache.tools.ant.types.Path path)
        Parameters:
        path -
      • setCompileToDir

        public void setCompileToDir(java.lang.String string)
        Parameters:
        string -
      • setCompileToWebInf

        public void setCompileToWebInf(java.lang.String string)
        Parameters:
        string -
      • setConfigRoot

        public void setConfigRoot(java.lang.String string)
        Parameters:
        string -
      • setCreateDebugClassfiles

        public void setCreateDebugClassfiles(java.lang.String string)
        Parameters:
        string -
      • setDeprecation

        public void setDeprecation(java.lang.String string)
        Parameters:
        string -
      • setJavaEncoding

        public void setJavaEncoding(java.lang.String string)
        Parameters:
        string -
      • setCompileWithAssert

        public void setCompileWithAssert(java.lang.String string)
        Deprecated. setCompileWithAssert is replaced by setJdkSourceLevel(java.lang.String)
        Parameters:
        string -
      • setJdkSourceLevel

        public void setJdkSourceLevel(java.lang.String string)
        Parameters:
        string -
      • setEarPath

        public void setEarPath(java.lang.String string)
        Parameters:
        string -
      • setEnterpriseAppName

        public void setEnterpriseAppName(java.lang.String string)
        Parameters:
        string -
      • setExtractToDir

        public void setExtractToDir(java.lang.String string)
        Parameters:
        string -
      • setFileName

        public void setFileName(java.lang.String string)
        Parameters:
        string -
      • setForceCompilation

        public void setForceCompilation(java.lang.String string)
        Parameters:
        string -
      • setUseFullPackageNames

        public void setUseFullPackageNames(java.lang.String string)
        Parameters:
        string -
      • setKeepgenerated

        public void setKeepgenerated(java.lang.String string)
        Parameters:
        string -
      • setKeepGeneratedclassfiles

        public void setKeepGeneratedclassfiles(java.lang.String string)
        Parameters:
        string -
      • setLogLevel

        public void setLogLevel(java.lang.String string)
        Parameters:
        string -
      • setNodeName

        public void setNodeName(java.lang.String string)
        Parameters:
        string -
      • setResponseFile

        public void setResponseFile(java.lang.String string)
        Parameters:
        string -
      • setServerName

        public void setServerName(java.lang.String string)
        Parameters:
        string -
      • setProfileName

        public void setProfileName(java.lang.String string)
      • setTrackDependencies

        public void setTrackDependencies(java.lang.String string)
        Parameters:
        string -
      • setUseJikes

        public void setUseJikes(java.lang.String string)
        Parameters:
        string -
      • setUseJDKCompiler

        public void setUseJDKCompiler(java.lang.String string)
        Parameters:
        string -
      • setUseRepeatInt

        public void setUseRepeatInt(java.lang.String string)
      • setAllowJspOutputElementMismatch

        public void setAllowJspOutputElementMismatch(java.lang.String string)
      • setAllowTaglibPrefixRedefinition

        public void setAllowTaglibPrefixRedefinition(java.lang.String string)
      • setAllowTaglibPrefixUseBeforeDefinition

        public void setAllowTaglibPrefixUseBeforeDefinition(java.lang.String string)
      • setAllowUnmatchedEndTag

        public void setAllowUnmatchedEndTag(java.lang.String string)
      • setUseScriptVarDupInit

        public void setUseScriptVarDupInit(java.lang.String string)
      • setUseIterationEval

        public void setUseIterationEval(java.lang.String string)
      • setUseCDataTrim

        public void setUseCDataTrim(java.lang.String string)
      • setDisableURLEncodingForParamTag

        public void setDisableURLEncodingForParamTag(java.lang.String string)
        Parameters:
        string -
      • setUsePageTagPool

        public void setUsePageTagPool(java.lang.String string)
        Parameters:
        string -
      • setUseThreadTagPool

        public void setUseThreadTagPool(java.lang.String string)
        Parameters:
        string -
      • setVerbose

        public void setVerbose(java.lang.String string)
        Parameters:
        string -
      • setWarPath

        public void setWarPath(java.lang.String string)
        Parameters:
        string -
      • setWebmoduleName

        public void setWebmoduleName(java.lang.String string)
        Parameters:
        string -
      • setJspFileExtensions

        public void setJspFileExtensions(java.lang.String string)
        Parameters:
        string -
      • setCompile

        public void setCompile(java.lang.String string)
        Parameters:
        string -
      • setCompilerOptions

        public void setCompilerOptions(java.lang.String string)
        Parameters:
        string -
      • setJspCompileClasspath

        public void setJspCompileClasspath(java.lang.String string)
        Parameters:
        string -
      • setRecurse

        public void setRecurse(java.lang.String string)
        Parameters:
        string -
      • setRemoveTempDir

        public void setRemoveTempDir(java.lang.String string)
        Parameters:
        string -
      • setTranslate

        public void setTranslate(java.lang.String string)
        Parameters:
        string -
      • setJvmMaxMemory

        public void setJvmMaxMemory(java.lang.String jvmMaxMemory)
        Sets the jvmMaxMemory.
        Parameters:
        jvmMaxMemory - The JVM MaxMemory to set
      • isDebug

        public boolean isDebug()
        Returns:
      • setDebug

        public void setDebug(boolean debug)
        Parameters:
        debug -
      • setFileEncoding

        public void setFileEncoding(java.lang.String fileEncoding)
        Parameters:
        fileEncoding - The fileEncoding to set.
IBM WebSphere Application ServerTM
Release 8.5