0

我是 java 的初学者,我正在做一个 java web applicatiom,但是当我在浏览器中访问我的项目时,我得到了“Directory Listing For /”语句。为什么会这样?

4

2 回答 2

0

I found the solution you need ...

you must know the basics about Dynamic Web Application

In Eclipse when you create a new Dynamic Web Project and then run the project you will get the directory list

read the reference #1 you will feel happy to read it don`t be afraid i read it

Apache Tomcat 7 How to Install & Configure

and #2 How do I specify the Tomcat context configuration for my Web Application?

they summerize the reference

Official reference from Tomcat site you may find it advanced ! so keep it as last resort

after reading reference #1 you will understand the solution

i created new dynamic web project named test the

1- "Change Port Of server" go to server.xml file in your Servers folder and modify

<Connector connectionTimeout="20000" port="9999" protocol="HTTP/1.1" redirectPort="8443"/>

i did not do any thing but to specify the port to 9999 instead of the default one note: this step is not a must but some times the default port is used by another program , you do it to make sure.

2- "Assign Context Path Parameter" Now go to context.xml in Servers folder too and put your context path

<Context reloadable="true" path="/test">

All i did in this step is putting path attribute and assign it to test for example but name it as your project name as best practice

3- "Assign relative Url" I created NewFile.jsp in the root of my project and in WEB-INF folder the file web.xml

put these lines and remove the existing default ones

<display-name>test</display-name>
  <welcome-file-list>    
    <welcome-file>NewFile.jsp</welcome-file>
  </welcome-file-list>

This means the default page when run the project thats what i read, understood and tested

于 2012-06-10T18:48:02.673 回答
0

您似乎没有可登陆的默认网页。

通常这样的页面被称为index.html。尝试将此页面添加到项目的根目录,然后重试。

于 2012-06-10T15:01:42.600 回答