Marcos Garcia
Marcos Garcia

Reputation: 51

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.

How can I do it? Thanks in advance.

Upvotes: 1

Views: 1956

Answers (1)

skomisa
skomisa

Reputation: 17363

Configure the URL to be used when you run your project as follows:

  • Select your project in the Projects panel, right click and select Properties... from the context menu.
  • Select Run from the list of categories.
  • You should see that Context Path already is set to something. It is set to /WebApplication1 in the sample screen shot below. Leave that field alone.
  • Specify the Relative URL you want to be used when NetBeans runs your application. By default it will be empty. The value you provide will be appended to the context path to construct the 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.
  • When your web application is run, the URL to be used is logged to the run window. Note the text Browsing: http://localhost:8080/WebApplication1/Servlet1 near the bottom of the screen shot.

RelativeURL

Upvotes: 2

Related Questions