Netbeans中的Java EE项目中的index.jsp默认在哪里? [英] index.jsp default in Java EE project in Netbeans, where?

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

问题描述

我在Netbeans中创建了一个名为WebApplication1的简单Web应用程序。有一个文件被创建,名为 index.jsp 。当我运行应用程序时,浏览器转到 index.jsp 。在项目中没有其他地方提到它是欢迎页面,那么它是如何进入的?我在nbproject文件夹中检查了build.xml,glassfish-web.xml和所有xml,prop文件,但没有提及 index.jsp 。它是如何进行的?

解决方案

在Netbeans默认情况下,如果您创建一个没有添加框架的项目, xml)被提供。
要更改它,右键单击该项目并选择新建>其他> web>标准部署描述符(web.xml)



现在编辑web.xml并设置

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

为了将默认值更改为newjsp.jsp

UPDATE



明确地用于tomcat ....

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

 <! -   - > 
<! - 如果您在您自己的应用程序的web.xml中定义欢迎文件 - >
<! - 部署描述符,该列表*替换*配置的列表 - >
<! - 在这里,请确保包含您希望的任何默认值 - >
<! - - 在您的应用程序中使用。 - >

< 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默认显示的原因。


I create a simple web application in Netbeans, named WebApplication1. There is a file created, named index.jsp. When I run the app, browser goes to index.jsp. Nowhere in the project it's mentioned as welcome page, then how it's going there? I checked build.xml, glassfish-web.xml and all xml, prop files in nbproject folder, but nowhere is the mention of index.jsp. How it's taking?

解决方案

In Netbeans by default, if you create a project with no added frameworks, no deployment descriptor(web.xml) is provided. To change it, right click on the project and select New>Other>web>Standard Deployment Descriptor(web.xml)

Now edit the web.xml and set

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

In order to change the default to newjsp.jsp

UPDATE

Explicitly for tomcat....

If no web.xml 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>

That is why the index.jsp is shown by default

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

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