File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes HTTP Status 404 - /onjava/servlet/com.onjava.login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "HTTP Status 404 - /onjava/servlet/com.onjava.login" Watch "HTTP Status 404 - /onjava/servlet/com.onjava.login" New topic
Author

HTTP Status 404 - /onjava/servlet/com.onjava.login

roy ramos
Greenhorn

Joined: Nov 17, 2009
Posts: 26
Hi there i'm new in java and i was trying to follow some examples that i got also from internet it's how to create login form,
the login.jsp file is working but as soon as i click the submit button it gives me the error

HTTP Status 404 - /onjava/servlet/com.onjava.login

i'm wondering why there is additional directory being called"servlet"

this is how i created the folder in tomcat 6.0


webapps
|
onjava
|
WEB-INF
|
web.xml
lib
classes
|
com
|
onjava
|
login.class

this is the login.jsp file

<html>
<head>
<title>OnJava Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#66CCFF" onLoad="document.loginForm.username.focus()">

<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<form name="loginForm" method="post" action="servlet/com.onjava.login">
<tr>
<td width="401"><div align="right">User Name: </div></td>
<td width="399"><input type="text" name="username"></td>
</tr>
<tr>
<td width="401"><div align="right">Password: </div></td>
<td width="399"><input type="password" name="password"></td>
</tr>
<tr>
<td width="401"> </td>
<td width="399"><br><input type="Submit" name="Submit"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html

this it web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>Login Application</display-name>
<description>
Login Application
</description>

<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>

</web-app>


-roy
 
 
subject: HTTP Status 404 - /onjava/servlet/com.onjava.login