简体   繁体   English

如何在Netbeans Java Web项目模板中设置起始页?

[英]How to set starting page in Netbeans Java Web project template?

When I run a java web project it always opens in my browser the "index.html" page, so I want to choose another page when the project starts.当我运行 java web 项目时,它总是在我的浏览器中打开“index.html”页面,所以我想在项目启动时选择另一个页面。

How can I do it?我该怎么做? Thanks in advance.提前致谢。

Configure the URL to be used when you run your project as follows:如下配置运行项目时要使用的 URL:

  • Select your project in the Projects panel, right click and select Properties... from the context menu. Select项目面板中的项目,右键单击并从上下文菜单中选择 select属性...。
  • Select Run from the list of categories. Select 从类别列表中运行
  • You should see that Context Path already is set to something.您应该看到Context Path已经设置为某个值。 It is set to /WebApplication1 in the sample screen shot below.在下面的示例屏幕截图中,它设置为/WebApplication1 Leave that field alone.不理会那个领域。
  • Specify the Relative URL you want to be used when NetBeans runs your application.指定在 NetBeans 运行您的应用程序时要使用的相对 URL By default it will be empty.默认情况下,它将为空。 The value you provide will be appended to the context path to construct the URL.您提供的值将附加到上下文路径以构造 URL。 In the screen shot below the relative URL is set to /Servlet1 , so this will be be appended to the context path of /WebApplication1 to build the URL http://localhost:8080/WebApplication1/Servlet1 to be used when the application is run. In the screen shot below the relative URL is set to /Servlet1 , so this will be be appended to the context path of /WebApplication1 to build the URL http://localhost:8080/WebApplication1/Servlet1 to be used when the application is run .
  • When your web application is run, the URL to be used is logged to the run window.当您的 web 应用程序运行时,要使用的 URL 将记录到运行 window。 Note the text Browsing: http://localhost:8080/WebApplication1/Servlet1 near the bottom of the screen shot.请注意屏幕截图底部附近的文本Browsing: http://localhost:8080/WebApplication1/Servlet1

相对网址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM