设为首页 - 加入收藏 站长在线 - 常用服务器软件 - 在线站长工具 - 在线伪原创工具
您的当前位置:主页 > 网络教程 > JSP教程 > 正文

Jasper 2 JSP Engine How To

来源:ZzWww 编辑:ZzWww 时间:2018-02-10

Links

User Guide

Reference

Apache Tomcat Development

Jasper 2 JSP Engine How To

Table of Contents

Introduction

Tomcat 7.0 uses the Jasper 2 JSP Engine to implement the JavaServer Pages 2.2 specification.

Jasper 2 has been redesigned to significantly improve performance over the original Jasper. In addition to general code improvements the following changes were made:

  • JSP Custom Tag Pooling - The java objects instantiated for JSP Custom Tags can now be pooled and reused. This significantly boosts the performance of JSP pages which use custom tags.
  • Background JSP compilation - If you make a change to a JSP page which had already been compiled Jasper 2 can recompile that page in the background. The previously compiled JSP page will still be available to serve requests. Once the new page has been compiled successfully it will replace the old page. This helps improve availability of your JSP pages on a production server.
  • Recompile JSP when included page changes - Jasper 2 can now detect when a page included at compile time from a JSP has changed and then recompile the parent JSP.
  • JDT used to compile JSP pages - The Eclipse JDT Java compiler is now used to perform JSP java source code compilation. This compiler loads source dependencies from the container classloader. Ant and javac can still be used.
  • Jasper is implemented using the servlet class org.apache.jasper.servlet.JspServlet.

    Configuration

    By default Jasper is configured for use when doing web application development. See the section Production Configuration for information on configuring Jasper for use on a production Tomcat server.

    The servlet which implements Jasper is configured using init parameters in your global $CATALINA_BASE/conf/web.xml.

  • checkInterval - If development is false and checkInterval is greater than zero, background compiles are enabled. checkInterval is the time in seconds between checks to see if a JSP page (and its dependent files) needs to be recompiled. Default 0 seconds.
  • classdebuginfo - Should the class file be compiled with debugging information? true or false, default true.
  • classpath - Defines the class path to be used to compile the generated servlets. This parameter only has an effect if the ServletContext attribute org.apache.jasper.Constants.SERVLET_CLASSPATH is not set. This attribute is always set when Jasper is used within Tomcat. By default the classpath is created dynamically based on the current web application.
  • compiler - Which compiler Ant should use to compile JSP pages. The valid values for this are the same as for the compiler attribute of Ant's task. If the value is not set, then the default Eclipse JDT Java compiler will be used instead of using Ant. There is no default value. If this attribute is set then setenv.[sh|bat] should be used to add ant.jar, ant-launcher.jar and tools.jar to the CLASSPATH environment variable.
  • compilerSourceVM - What JDK version are the source files compatible with? (Default value: 1.6)
  • compilerTargetVM - What JDK version are the generated files compatible with? (Default value: 1.6)
  • development - Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.true or false, default true.
  • displaySourceFragment - Should a source fragment be included in exception messages? true or false, default true.
  • dumpSmap - Should the SMAP info for JSR45 debugging be dumped to a file? true or false, default false. false if suppressSmap is true.
  • enablePooling - Determines whether tag handler pooling is enabled. This is a compilation option. It will not alter the behaviour of JSPs that have already been compiled. true or false, default true.
  • engineOptionsClass - Allows specifying the Options class used to configure Jasper. If not present, the default EmbeddedServletOptions will be used. This option is ignored if running under a SecurityManager.
  • errorOnUseBeanInvalidClassAttribute - Should Jasper issue an error when the value of the class attribute in an useBean action is not a valid bean class? true or false, default true.
  • fork - Have Ant fork JSP page compiles so they are performed in a separate JVM from Tomcat? true or false, default true.
  • genStringAsCharArray - Should text strings be generated as char arrays, to improve performance in some cases? Default false.
  • ieClassId - The class-id value to be sent to Internet Explorer when using <jsp:plugin> tags. Default clsid:8AD9C840-044E-11D1-B3E9-00805F499D93.
  • javaEncoding - Java file encoding to use for generating java source files. Default UTF8.
  • keepgenerated - Should we keep the generated Java source code for each page instead of deleting it? true or false, default true.
  • mappedfile - Should we generate static content with one print statement per input line, to ease debugging? true or false, default true.
  • maxLoadedJsps - The maximum number of JSPs that will be loaded for a web application. If more than this number of JSPs are loaded, the least recently used JSPs will be unloaded so that the number of JSPs loaded at any one time does not exceed this limit. A value of zero or less indicates no limit. Default -1
  • jspIdleTimeout - The amount of time in seconds a JSP can be idle before it is unloaded. A value of zero or less indicates never unload. Default -1
  • modificationTestInterval - Causes a JSP (and its dependent files) to not be checked for modification during the specified time interval (in seconds) from the last time the JSP was checked for modification. A value of 0 will cause the JSP to be checked on every access. Used in development mode only. Default is 4 seconds.
  • recompileOnFail - If a JSP compilation fails should the modificationTestInterval be ignored and the next access trigger a re-compilation attempt? Used in development mode only and is disabled by default as compilation may be expensive and could lead to excessive resource usage.
  • scratchdir - What scratch directory should we use when compiling JSP pages? Default is the work directory for the current web application. This option is ignored if running under a SecurityManager.
  • suppressSmap - Should the generation of SMAP info for JSR45 debugging be suppressed? true or false, default false.
  • trimSpaces - Should template text that consists entirely of whitespace be removed? true or false, default false.
  • xpoweredBy - Determines whether X-Powered-By response header is added by generated servlet. true or false, default false.
  • quoteAttributeEL - When EL is used in an attribute value on a JSP page, should the rules for quoting of attributes described in JSP.1.6 be applied to the expression? true or false, default true.

  • TAG标签:Engine Jasper

    网友评论:

    文章右边250
    Top