質問

I am using WebSphere Developer Tools for Eclipse Kepler and I cannot get my application to runtime reload changes in JSP. I am pretty bad at jsp and having runtime dynamically reload changes will really speed up project development.

Referring to this article: http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=/com.ibm.websphere.ihs.doc/ihs/tihs_startadmserv.html

I created a very simple war project with one jsp and added WEB-INF/ibm-web-ext.xml as follow:

<?xml version="1.0" encoding="UTF-8"?>
<web-ext
    xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
    version="1.0">

    <jsp-attribute name="trackDependencies" value="false" />
    <jsp-attribute name="reloadEnabled" value="true" />
    <jsp-attribute name="reloadInterval" value="5" />
    <jsp-attribute name="verbose" value="true"/>
    <jsp-attribute name="disableJspRuntimeCompilation" value="false"/>

    <reload-interval value="5"/>
    <enable-directory-browsing value="false"/>
    <enable-file-serving value="false"/>
    <pre-compile-jsps value="false"/>
    <enable-reloading value="true"/>
    <enable-serving-servlets-by-class-name value="false" />
</web-ext>

On Eclipse, I just right click Run As -> Run on Server. But whenever I change my JSPs, changes simply won't take effect until I "Publish" my project.

On Eclipse, I disabled automatically publishing because whenever I publish, my project will restart and it take about 1 minutes to fully published the changes.

I really like runtime reloading JSP to speed up my development. Any help is much appreciated. Many thanks.

役に立ちましたか?

解決

I finally solved the problem and it got nothing to do with websphere.

My project is using maven m2e plugin and in preference "Java EE > Maven > Maven Project Settings" I have click "Set all Maven values".

This change the Dynamic Web Project Output Folder to "src/main/webapp/WEB-INF/classes" instead of "target/classes".

The .classpath file is still referencing "target/classes".

I added this line to my WAR pom.xml:

<build> 
  <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
.
.
</build>

And the runtime loading of JSP works as expected!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top