开发者

Jsp compilation not on the fly with jboss

It is possible to compile jsp during the application deployment or during jboss startup? Usually jsp are co开发者_运维问答mpiled on the fly but it would be convenient if the compilation was done before...

I read it is not possible anymore to precompile jsp wit jee6... That's why libraries are not supplied with jboss 6. Is there another way to do that?

Thanks in advance!


You need to modify $server/deploy/jbossweb.sar/web.xml and have the jsp servlet include a positive check value

   <servlet>
      <servlet-name>jsp</servlet-name>
      <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
      <init-param>
         <param-name>checkInterval</param-name>
         <param-value>1</param-value>
      </init-param>

See the docs above the tag:

   <!--   checkInterval       If development is false and checkInterval is   -->
   <!--                       greater than zero, background compilations are -->
   <!--                       enabled. checkInterval is the time in seconds  -->
   <!--                       between checks to see if a JSP page needs to   -->
   <!--                       be recompiled. [0]                             -->
   <!--                                                                      -->
   <!--   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. [4]             -->


I was facing similar issue in my development environment. Thanks to Heiko's answer, I tried another option by setting development and modificationTestInterval as follows in the web.xml.

  <init-param>
     <param-name>development</param-name>
     <param-value>true</param-value>
  </init-param>
  <init-param>
     <param-name>modificationTestInterval</param-name>
     <param-value>0</param-value>
  </init-param>

Now I'm able to modify the JSPs in '$JBOSS_HOME\server\default\tmp\%random_crap%\war-1.0.war\WEB-INF\jsp' and have it recompile without restarting JBOSS.

Also want to note this was not required in JBoss 4.3, so for developers upgrading from 4.3 to 5.2 just be aware of this extra step.


By default, last versions of JBoss like EAP 6 precompile all the JSP and use that coompiled version untill ther is a full redeployment of the aplication.

You can use 'Keep-Generated' and 'Check-Interval' parameters to modify that behaviour, so that JBoss recompile JSPs any time they are updated. You have a detail description of those parameters at:

https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html/Administration_and_Configuration_Guide/chap-Web_Subsystem.html

Regards, Gonzalo

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜