1

I'm working on Windows 7 with Eclipse Java EE IDE for Web Developers , and Tomcat 7 .

The hierarchy of my project is :

enter image description here

When I run the following web.xml , meaning I hit CTRL+F11 from within Eclipse the following web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>LoginExample</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

I get this :

enter image description here

enter image description here

I don't understand what causes this , any idea anyone ?

Here is index.jsp :

<%@ page language="java" 
    contentType="text/html; charset=windows-1256"
    pageEncoding="windows-1256"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
                                <meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
        <title>Login Page</title>
    </head>

    <body>
        <form action="LoginServlet">

            Please enter your username      
            <input type="text" name="un"/><br>      

            Please enter your password
            <input type="text" name="pw"/>

            <input type="submit" value="submit">            

        </form>
    </body>
</html>

Thanks

JAN
  • 21,236
  • 66
  • 181
  • 318

3 Answers3

2

WEB-INF is a protected folder, servlet container (Tomcat in your case) won't allow you to access it. It would be quite bad if anybody could take a look on your web application settings (especially the security ones). Just go to the localhost:8080/LoginExample/index.jsp, then you can see your page.

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
1

You cannot access the the WEB-INF directory or any of its contents directly from a web application.

If you want to access the index.jsp page, just open the URL http://localhost:8080/LoginExample and the web server would forward you to the index.jsp (as specified in the web.xml)

Or you can always access the page directly using its full path as in http://localhost:8080/LoginExample/index.jsp

Ahmad Y. Saleh
  • 3,309
  • 7
  • 32
  • 43
1

Try to change the path, instead of /WEB-INF/web.xml to /index.jsp, if this does not work try to resolve it, with servlet maping,something like this Servlet JSP web.xml.

Community
  • 1
  • 1
Kjiro
  • 49
  • 2
  • 8