This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes HTTP Status 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 " Watch "HTTP Status 404 " New topic
Author

HTTP Status 404

partha sama
Greenhorn

Joined: Sep 07, 2012
Posts: 2
Hi all,

I have just started learning servlets few days back. I am trying to execute a simple servlet program but there is an error coming up. I tried to check the previous posts related to this error but i could not solve it. I am posting the web.xml file, the html file and servlet to make things more clear to you.

html file:
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action ="loginProcess">
Firstname : <input type = "text" name = "firstname"><br>
Lastname :<input type = "text" name ="Lastname"><br>
Password :<input type = "password" name ="passcode"><br>
<input type ="submit" value ="register">


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


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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Register</display-name>
<servlet>
<servlet-name>LoginServlet1</servlet-name>
<servlet-class>com.controller.LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LoginServlet1</servlet-name>
<url-pattern>/loginProcess</url-pattern>
</servlet-mapping>
</web-app>


servlet:

package com.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginServlet extends HttpServlet {


@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("**logingserlvet**");
super.doGet(req, resp);
}

}

I checked whether the directory structure of the project and it seems to be correct. I think i have also given a write url pattern in web.xml file. I don't know if i am missing something. Any help is appreciated.
pankaj rawat
Greenhorn

Joined: Sep 07, 2012
Posts: 2
you should check web.xml file.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

See the ServletsFaq where this issue is addressed.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
pankaj rawat
Greenhorn

Joined: Sep 07, 2012
Posts: 2
In web.xml you have write the servlet name "LoginServlet1" which should be like that "LoginServlet".
Vineet P Rao
Greenhorn

Joined: Sep 17, 2012
Posts: 3
Ideally a page with password should be sent as a POST method rather than a GET to avoid it from displaying it on the URL.

How are you deploying this application? Most probably the class file of the servlet is not where it should be.


My blog: http://www.quicklyjava.com
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Vineet P Rao wrote:Ideally a page with password should be sent as a POST method rather than a GET to avoid it from displaying it on the URL.

However, sending it as a POST makes it no more secure than making it a GET. For security, the request must be encrypted via SSL.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404