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 7.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>JSPC Task</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 and turn JSP pages into Java source.
  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. This can also be specified
  67. by the nested element <code>classpath</code>
  68. <a href="../using.html#path">Path</a>).</td>
  69. <td valign="top" align="center">No</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">classpathref</td>
  73. <td valign="top">A <a href="../using.html#references">Reference</a>. As
  74. per <code>classpath</code></td>
  75. <td valign="top" align="center">No</td>
  76. </tr>
  77. <tr>
  78. <td valign="top">failonerror</td>
  79. <td valign="top">flag to control action on compile failures: default=yes</td>
  80. <td valign="top" align="center">No</td>
  81. </tr>
  82. <tr>
  83. <td valign="top">uribase</td>
  84. <td valign="top">
  85. The uri context of relative URI
  86. references in the JSP pages. If it does not
  87. exist then it is derived from the location of the file
  88. relative to the declared or derived value of <tt>uriroot.</tt>
  89. </td>
  90. <td valign="top" align="center">No</td>
  91. </tr>
  92. <tr>
  93. <td valign="top">uriroot</td>
  94. <td valign="top">
  95. The root directory that uri files should be resolved
  96. against.
  97. </td>
  98. <td valign="top" align="center">No</td>
  99. </tr>
  100. </table>
  101. <P>The <tt>mapped</tt> option will, if set to true, split the JSP text content into a
  102. one line per call format. There are comments above and below the mapped
  103. write calls to localize where in the JSP file each line of text comes
  104. from. This can lead to a minor performance degradation (but it is bound
  105. by a linear complexity). Without this options all adjacent writes are
  106. concatenated into a single write.</P>
  107. <P>The <tt>ieplugin</tt> option is used by the <tt>&lt;jsp:plugin&gt;</tt> tags.
  108. If the Java Plug-in COM Class-ID you want to use changes then it can be
  109. specified here. This should not need to be altered.</P>
  110. <P><tt>uriroot</tt> specifies the root of the web
  111. application. This is where all absolute uris will be resolved from.
  112. If it is not specified then the first JSP page will be used to derive
  113. it. To derive it each parent directory of the first JSP page is
  114. searched for a <tt>WEB-INF</tt> directory, and the directory closest to
  115. the JSP page that has one will be used. If none can be found then the
  116. directory Jasperc was called from will be used. This only affects pages
  117. translated from an explicitly declared JSP file -including references
  118. to taglibs</P>
  119. <P><tt>uribase</tt> is used to establish the uri context of
  120. relative URI references in the JSP pages. If it does not exist then it
  121. is derived from the location of the file relative to the declared or
  122. derived value of <tt>uriroot</tt>. This only affects pages
  123. translated from an explicitly declared JSP file.</P>
  124. <h3>Parameters specified as nested elements</h3>
  125. This task is a <a href="../dirtasks.html">directory based task</a>, like
  126. <strong>javac</strong>, so the jsp files to be compiled are located as java
  127. files are by <strong>javac</strong>. That is, elements such as <tt>includes</tt> and
  128. <tt>excludes</tt> can be used directly inside the task declaration.
  129. <p>
  130. Elements specific to the jspc task are:-
  131. <h4>classpath</h4>
  132. The classpath used to compile the JSP pages, specified as for any other
  133. classpath.
  134. <h4>classpathref</h4>
  135. a reference to an existing classpath
  136. <h3>Example</h3>
  137. <pre>
  138. &lt;jspc srcdir="${basedir}/src/war"
  139. destdir="${basedir}/gensrc"
  140. package="com.i3sp.jsp"
  141. verbose="9"&gt;
  142. &lt;include name="**/*.jsp" /&gt;
  143. &lt;/jspc&gt;
  144. </pre>
  145. Build all jsp pages under src/war into the destination /gensrc, in a
  146. package heirarchy beginning with com.i3sp.jsp.
  147. <pre>
  148. &lt;jspc
  149. destdir="interim"
  150. verbose="1"&gt;
  151. srcdir="src"
  152. package="com.i3sp.jsp"
  153. &lt;include name="**/*.jsp" /&gt;
  154. &lt;/jspc&gt;
  155. &lt;depends
  156. srcdir="interim"
  157. destdir="build"
  158. cache="build/dependencies"
  159. classpath="lib/taglibs.jar"/&gt;
  160. &lt;javac
  161. srcdir="interim"
  162. destdir="build"
  163. classpath="lib/taglibs.jar"
  164. debug="on" /&gt;
  165. </pre>
  166. Generate jsp pages then javac them down to
  167. bytecodes. Include lib/taglib jar in the java compilation.
  168. Dependency checking is used to scrub the
  169. java files if class dependencies indicate it is needed.
  170. <p><h4>Notes</h4>
  171. <p> At present, this task only supports the jasper compiler. In future,
  172. other compilers will be supported by setting the <tt>jsp.compiler</tt> property.
  173. <p> The jasper compiler option <code>-webapp</code> is not supported. Using
  174. the <code>package</code> attribute it is possible to identify the resulting
  175. java files and thus do full dependency checking - this task only rebuilds
  176. java files if their jsp file has been modified.
  177. <p>
  178. Jasper generates JSP pages against the JSP1.3 specification -an implementation of
  179. version 2.2 of the servlet specification is needed to compile or run the java code.
  180. <hr>
  181. <p align="center">Copyright &copy; 2001 Apache Software Foundation. All rights
  182. Reserved.</p>
  183. </body>
  184. </html>