NetBeans 的 Java EE 项目中的默认 index.jsp 文件在哪里? [英] Where is the default index.jsp file in a Java EE project in NetBeans?

查看:59
本文介绍了NetBeans 的 Java EE 项目中的默认 index.jsp 文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 NetBeans 中创建了一个简单的 Web 应用程序,名为 WebApplication1.创建了一个名为 index.jsp 的文件.当我运行应用程序时,浏览器转到 index.jsp.

I create a simple web application in NetBeans, named WebApplication1. There is a file created, named index.jsp. When I run the application, and the browser goes to index.jsp.

项目中没有任何地方提到它作为欢迎页面.那怎么去那里?

Nowhere in the project is it mentioned as the welcome page. Then how is it going there?

我检查了 nbproject 文件夹中的文件 build.xmlglassfish-web.xml、所有 XML 文件和 prop 文件,但是没有任何地方提到 index.jsp.进展如何?

I checked files build.xml, glassfish-web.xml, all XML files, and prop files in the nbproject folder, but nowhere is the mention of index.jsp. How is it taking?

推荐答案

在 NetBeans 中,默认情况下,如果您创建的项目没有添加框架,则不会提供部署描述符(文件 web.xml).

In NetBeans by default, if you create a project with no added frameworks, no deployment descriptor (file web.xml) is provided.

要更改它,请右键单击项目并选择New>Other>web>Standard Deployment Descriptor(web.xml).

To change it, right click on the project and select New>Other>web>Standard Deployment Descriptor(web.xml).

现在编辑 web.xml 文件并设置

Now edit the web.xml file and set

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

为了改变默认文件newjsp.jsp.

明确用于 Tomcat...

如果应用程序中没有提供 web.xml 文件,则将 Tomcat 的默认 web.xml($CATALINA_HOME/conf/web.xml) 提供给应用程序.这个部署描述符有以下几行:

If no web.xml file is provided in the application, the default web.xml($CATALINA_HOME/conf/web.xml) of Tomcat is supplied to the application. This deployment descriptor has the following lines:

<!-- -->
<!-- If you define welcome files in your own application's web.xml -->
<!-- deployment descriptor, that list *replaces* the list configured -->
<!-- here, so be sure to include any of the default values that you wish -->
<!-- to use within your application. -->

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

这就是默认显示 index.jsp 文件的原因.

That is why the index.jsp file is shown by default.

这篇关于NetBeans 的 Java EE 项目中的默认 index.jsp 文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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