Eclipse& Tomcat:如何指定从项目中提供的文件夹? [英] Eclipse & Tomcat: How to specify which folder is served from the project?

查看:390
本文介绍了Eclipse& Tomcat:如何指定从项目中提供的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse 3.4和Tomcat 5.5,并且我已经设置了动态Web项目。我可以从 http://127.0.0.1:8080/project/ 访问它,但默认情况下它会提供WebContent文件夹中的文件。我想要提供的真实文件可以在名为share的文件夹下找到。这个文件夹来自CVS所以我想用它给定的名字而不是重命名它。如何做到这一点?

I'm using Eclipse 3.4 and Tomcat 5.5 and I have a Dynamic Web Project set up. I can access it from http://127.0.0.1:8080/project/ but by default it serves files from WebContent folder. The real files, that I want to serve, can be found under folder named "share". This folder comes from CVS so I'd like to use it with its given name instead of renaming it. How can this be done?

推荐答案

在项目文件夹中,下应该有一个文件。设置名为的文件夹org.eclipse.wst.common.component 包含这样的XML片段:

In the project folder, there should be a file under the .settings folder named org.eclipse.wst.common.component that contains an XML fragment like this:

<wb-module deploy-name="WebProjectName">
    <wb-resource deploy-path="/" source-path="/WebContent"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>

您应该能够在 wb-resource <下更改源路径/ code>到您的共享文件夹。我将关闭Eclipse项目进行这些更改以保证安全。

You should be able to change the source-path under wb-resource to your share folder. I'd make these changes with the Eclipse project closed to be safe.

这是您在Eclipse中首次创建Dynamic Web Project时选择的设置 - 我可以找不到如何通过Eclipse本身更改现有项目中的值。

This is a setting that you pick when you first create the Dynamic Web Project in Eclipse - I can't find how to change the value in an existing project thru Eclipse itself.

如果要在部署时将共享文件夹映射到其他路径,例如<您的webapp中的code> / share / ,您可以添加另一个wb-resource元素。

If you want the share folder to be mapped to a different path when deployed, such as /share/ in your webapp, you can probably just add another wb-resource element.

这篇关于Eclipse&amp; Tomcat:如何指定从项目中提供的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆