0

I have a servlets project called LoginPortal. In this project, I intend to add an html called login.html and a css file called login.css . I added them to Webcontent folder which is where I added other html files that I created in project it self. Besides login.html and login.css, all other files were created n the project only and so work just fine.

The directory structure now looks like this:

enter image description here

However , I still get 404 error when I try to access this html file added externally :

enter image description here

URL :http://localhost:8080/LoginPortal/login.html

What could be the possible reasons ?

7
  • Your screenshot contradicts your description: it shows login.html out of WEB-INF (which is a good thing: everything inside WEB-INF can't be accessed from the outside). Commented Mar 15, 2015 at 11:05
  • @JB NIzet: I am sorry, I meant web content folder only.When i create the html and css in eclipse, it works ,however ,adding them from outside directly in the same location does not. This is what is confusing me. Commented Mar 15, 2015 at 11:45
  • Have you redeployed the app? Commented Mar 15, 2015 at 12:15
  • 1
    are you adding files directly to the workspace/project folder instead of through eclipse?? Commented Mar 16, 2015 at 6:11
  • 1
    yes. Eclipse seems to maintain a list of files which it will deploy to target server when invoked. Since you added this externally and eclipse does not know, it will not deploy this files. Commented Mar 16, 2015 at 12:28

1 Answer 1

1

Eclipse seems to maintain a list of files which it will be deploy to target server when changed.

Since, you added those files externally and eclipse does not know about them yet, it will not deploy this files when changed. You can do this. after adding this files externally go to eclipse project explorer. Refresh your project from your context menu(Right click -> refresh). This will include the file you added and get listed.

The files will be added instantly when ever there is a changes, and is reflected in the output.

Sign up to request clarification or add additional context in comments.

3 Comments

The project indeed was refreshed and files were visible in eclipse project explorer.
what web server are you using?
I am using Apache Glassfish

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.