2014年7月15日 星期二

The default Context Path on 『Add & Remove Available Resource』set Tomcat with Eclipse.

When I use the『Add and Remove...』function on Server with IDE Eclipse.
I always have to rewrite the default Context Path on file server.xml.
Ex:
Before:
<Context docBase="test" path="/test" reloadable="true" source="org.eclipse.jst.jee.server:test"/></Host>
After:<Context docBase="test" path="/" reloadable="true" source="org.eclipse.jst.jee.server:test"/></Host>

If I want do it once.
Find the file 『org.eclipse.wst.common.component』 where located in folder 『.setting』.
The content is like:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="test">
        <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
        <property name="context-root" value="test"/>
        <property name="java-output-path" value="/test/build/classes"/>
    </wb-module>
</project-modules>

Just rewrite the fragment:
<property name="context-root" value="test"/>
to                                                                   ^^^^
<property name="context-root" value="xxxx"/>

Done.

Another way.
Right click on your 『Dynamic Web Project』.
Choose 『properties...』→『Web Project Settings』.
Rewrite the Content on 『Context root』.
Much easier.

Done.

沒有留言: