Woot4Moo
Woot4Moo

Reputation: 24336

Eclipse J2EE preview server fails to find deployed pages

I have a dynamic web project named Report that utilizes the default generation strategy employed by Eclipse. I have added a page hello.jsp underneath the WEB-INF directory and have deployed the the J2EE preview server. When the page launches in my browser I am directed to the following URL:
http://localhost:8080/Report

this page has two hyperlinks:

META-INF
WEB-INF

both with sizes of zero (0) bytes. My question is why am I unable to access /Report/hello.jsp? It results in a not found similarly /Report/WEB-INF/hello.jsp also results in a not found exception.

Upvotes: 0

Views: 2991

Answers (1)

BalusC
BalusC

Reputation: 1109222

Files in /WEB-INF and /META-INF folders are intented for MVC view files, template files, include files, tag files, configuration files, etc, not for public web resources which are intented to be directly accessed by URL.

Put your hello.jsp outside /WEB-INF folder and access it by /Report/hello.jsp instead.

WebContent
 |-- META-INF
 |-- WEB-INF
 |    `-- web.xml
 `-- hello.jsp

If you really need to have your JSP in /WEB-INF folder (in order to act as a MVC view), then you need to create a front controller servlet which serves it up by RequestDispatcher#forward(). See also our servlets wiki page for a kickoff example.

Upvotes: 2

Related Questions