You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

jspc.html 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</title>
  5. </head>
  6. <body>
  7. <h2><a name="jspc">jspc</a></h2>
  8. <h3>Description</h3>
  9. <p> Ant task to run the jsp compiler.
  10. <p>
  11. It can be used to precompile jsp pages for fast initial invocation
  12. of JSP pages, deployment on a server without the full JDK installed,
  13. or simply to syntax check the pages without deploying them.
  14. In most cases, a javac task is usually the next stage in the build process.
  15. The task does basic dependency checking to prevent unnecessary recompilation -this
  16. checking compares source and destination timestamps, and does not factor
  17. in class or taglib dependencies.
  18. <p>
  19. The task needs jasper.jar and jasper-runtime.jar, which come with
  20. builds of Tomcat 4/Catalina from the
  21. <a href="http://jakarta.apache.org/tomcat/">Jakarta Tomcat project</a>
  22. <h3>Parameters</h3>
  23. The Task has the following attributes:<p>
  24. <table border="1" cellpadding="2" cellspacing="0">
  25. <tr>
  26. <td valign="top"><b>Attribute</b></td>
  27. <td valign="top"><b>Description</b></td>
  28. <td align="center" valign="top"><b>Required</b></td>
  29. </tr>
  30. <tr>
  31. <td valign="top">destdir</td>
  32. <td valign="top">Where to place the generated files. They are located
  33. under here according to the given package name.</td>
  34. <td valign="top" align="center">Yes</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">srcdir</td>
  38. <td valign="top">Where to look for source jsp files.</td>
  39. <td valign="top" align="center">Yes</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">verbose</td>
  43. <td valign="top">The verbosity integer to pass to the compiler. Default="0"</td>
  44. <td valign="top" align="center">No</td>
  45. </tr>
  46. <tr>
  47. <td valign="top">package</td>
  48. <td valign="top">Name of the destination package for generated java
  49. classes.</td>
  50. <td valign="top" align="center">No</td>
  51. </tr>
  52. <tr>
  53. <td valign="top">ieplugin</td>
  54. <td valign="top">Java Plugin classid for Internet Explorer.</td>
  55. <td valign="top" align="center">No</td>
  56. </tr>
  57. <tr>
  58. <td valign="top">mapped</td>
  59. <td valign="top">(boolean) Generate separate write() calls for each HTML
  60. line in the JSP.</td>
  61. <td valign="top" align="center">No</td>
  62. </tr>
  63. <tr>
  64. <td valign="top">classpath</td>
  65. <td valign="top">The classpath to use to run the jsp compiler,
  66. and bring in any tag libraries.
  67. This can also be specified
  68. by the nested element <code>classpath</code>
  69. <a href="../using.html#path">Path</a>).</td>
  70. <td valign="top" align="center">No</td>
  71. </tr>
  72. <tr>
  73. <td valign="top">classpathref</td>
  74. <td valign="top">A <a href="../using.html#references">Reference</a>. As
  75. per <code>classpath</code></td>
  76. <td valign="top" align="center">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">failonerror</td>
  80. <td valign="top">flag to control action on compile failures: default=yes</td>
  81. <td valign="top" align="center">No</td>
  82. </tr>
  83. </table>
  84. <P>The <tt>mapped</tt> option will, if set to true, split the JSP text content into a
  85. one line per call format. There are comments above and below the mapped
  86. write calls to localize where in the JSP file each line of text comes
  87. from. This can lead to a minor performance degradation (but it is bound
  88. by a linear complexity). Without this options all adjacent writes are
  89. concatenated into a single write.</P>
  90. <P>The <tt>ieplugin</tt> option is used by the <tt>&lt;jsp:plugin&gt;</tt> tags.
  91. If the Java Plug-in COM Class-ID you want to use changes then it can be
  92. specified here. This should not need to be altered.</P>
  93. <h3>Parameters specified as nested elements</h3>
  94. This task is a <a href="../dirtasks.html">directory based task</a>, like
  95. <strong>javac</strong>, so the jsp files to be compiled are located as java
  96. files are by <strong>javac</strong>. That is, elements such as <tt>includes</tt> and
  97. <tt>excludes</tt> can be used directly inside the task declaration.
  98. <p>
  99. Elements specific to the jspc task are:-
  100. <h4>classpath</h4>
  101. The classpath used to compile the JSP pages is specified as for any other
  102. classpath. Even if the jasper jars are in the ant library directory, or
  103. are on the classpath in some other means, this element is important when
  104. referring to tag libraries.
  105. <h4>classpathref</h4>
  106. a reference to an existing classpath
  107. <h3>Example</h3>
  108. <pre>
  109. &lt;jspc srcdir="${basedir}/src/war"
  110. destdir="${basedir}/gensrc"
  111. package="com.i3sp.jsp"
  112. verbose="9"&gt;
  113. &lt;include name="**/*.jsp" /&gt;
  114. &lt;/jspc&gt;
  115. </pre>
  116. Build all jsp pages under src/war into the destination /gensrc, in a
  117. package heirarchy beginning with com.i3sp.jsp.
  118. <pre>
  119. &lt;jspc
  120. destdir="interim"
  121. verbose="1"&gt;
  122. classpath="lib/taglibs.jar"
  123. srcdir="src"
  124. package="com.i3sp.jsp"
  125. &lt;include name="**/*.jsp" /&gt;
  126. &lt;/jspc&gt;
  127. &lt;depends
  128. srcdir="interim"
  129. destdir="build"
  130. cache="build/dependencies"
  131. classpath="lib/taglibs.jar"/&gt;
  132. &lt;javac
  133. srcdir="interim"
  134. destdir="build"
  135. classpath="lib/taglibs.jar"
  136. debug="on" /&gt;
  137. </pre>
  138. Generate jsp pages then javac them down to
  139. bytecodes. Include lib/taglib jar in the
  140. JSP build and the compilation. Dependency checking is used to scrub the
  141. java files if class dependencies indicate it is needed.
  142. <p><h4>Notes</h4>
  143. <p> At present, this task only supports the jasper compiler. In future,
  144. other compilers will be supported by setting the <tt>jsp.compiler</tt> property.
  145. <p> The jasper compiler option <code>-webapp</code> is not supported. Using
  146. the <code>package</code> attribute it is possible to identify the resulting
  147. java files and thus do full dependency checking - this task only rebuilds
  148. java files if their jsp file has been modified.
  149. <hr>
  150. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  151. Reserved.</p>
  152. </body>
  153. </html>