Webapps with tomcat

Hi gurus,

I’m not sure if this is the right forum for this but here goes:

I have an servlet/jsp webapp called “intro”. Via Tomcat, the link is www.mysite.com/intro.

I’m developing this app in Eclipse. How can I change the name of the extension, so that the link will be www.mysite.com/newName?

I tried to google this, and came across refactoring but that didn’t work… thanks in advance.

I think you should do it in web.xml, just override the default welcome file list


<welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

Because if you do it in server.xml then it will set default page for all the webapplications in tomcat

I believe you’re talking about your sites context?

So, do you have www.mysite.com/intro/index.jsp working? OR do you have www.mysite.com/intro.jsp working?

And do you want www.mysite.com/newname/index.jsp working?

If so, that is a setting in your tomcat server.xml under the <context> section.

You would rename your “path” from path=“/intro” to path=“newname”.

Also if you setup a J2EE type project in eclipse you can edit your .settings/org.eclipse.wst.common.component file and change the “context-root” property and then perform a clean… on your Server so that everything gets re-published properly.

Thanks for the quick response!

I apologize for not specifying, in the address bar the user would only have to type in www.mysite.com/intro and the page that actually loads is www.mysite.com/intro/index.html

I tried your solution. Under the context in server.xml I changed the path to /newname instead of /intro, but then when restarting the server I received this error:

“Could not load the Tomcat server configuration at \Servers\Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete.”

If I changed the path back to /intro instead of /newname the server will once again work…

Thoughts? Many thx…

Nevermind, it works… thanks!

I had left the server.xml file open, and I guess that was causing the errors. :smiley:

Actually after editing your server.xml file in eclipse (Servers/Tomcat v6.0 Server at localhost-config/server.xml) I found that I have to do a (right click) Clean… (and republish) on that server in the Server tab.

Only after doing a clean/republish will your newly edited server.xml file take effect.

Glad everything worked out for you.

I forgot to mention that the above posts work only for the Galileo release of Eclipse.

It seems to me that previous versions of Eclipse required the .metadata\.metadata\.plugins\org.eclipse.wst.server.core\ mp0\conf\server.xml file to be edited directly for server changes to take affect.