•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 402,904 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,119 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1759 | Replies: 2
![]() |
•
•
Join Date: Jan 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Dear All
I admit that I am new to this all.
I am trying to run a simple login function.
I have two jsp files, login.jsp and welcome.jsp and I have one servelet login.java
My project name is onjava (I am doing this from an example from the web).
My directory structure is the following:
/onjava
/onjava/WEB-INF/classes/com/onjava/login.class
/onjava/WEB-INF/classes/com/onjava/login.java
/onjava/WEB-INF/lib
/onjava/WEB-INF/web.xml
/onjava/images/login_img.gif
/onjava/login.jsp
/onjava/welcome.jsp
The contents of login.jsp are:
The contents of web.xml are:
When I run this small functionality, my login page shows up perfectly, but when I put in the user name and the password, the page opens up with the following message.
---------------------------------------------------------------------------------------
HTTP Status 404 - /onjava/servlet/com.onjava.login
type Status report
message /onjava/servlet/com.onjava.login
description The requested resource (/onjava/servlet/com.onjava.login) is not available.
Apache Tomcat/5.5.17
----------------------------------------------------------------------------------------
I think there is some error in the action of the login.jsp page, I have tried many path options for the servelet, but nothing is working.
Any sort of help is very much appreciated.
I admit that I am new to this all.
I am trying to run a simple login function.
I have two jsp files, login.jsp and welcome.jsp and I have one servelet login.java
My project name is onjava (I am doing this from an example from the web).
My directory structure is the following:
/onjava
/onjava/WEB-INF/classes/com/onjava/login.class
/onjava/WEB-INF/classes/com/onjava/login.java
/onjava/WEB-INF/lib
/onjava/WEB-INF/web.xml
/onjava/images/login_img.gif
/onjava/login.jsp
/onjava/welcome.jsp
The contents of login.jsp are:
<html><head> <title>OnJava Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> <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></body></html>
The contents of web.xml are:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-appPUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>login</servlet-name> <servlet-class>com.onjava.login</servlet-class> </servlet></web-app>
When I run this small functionality, my login page shows up perfectly, but when I put in the user name and the password, the page opens up with the following message.
---------------------------------------------------------------------------------------
HTTP Status 404 - /onjava/servlet/com.onjava.login
type Status report
message /onjava/servlet/com.onjava.login
description The requested resource (/onjava/servlet/com.onjava.login) is not available.
Apache Tomcat/5.5.17
----------------------------------------------------------------------------------------
I think there is some error in the action of the login.jsp page, I have tried many path options for the servelet, but nothing is working.
Any sort of help is very much appreciated.
hi,
1) servlet mapping is missing as mentioned by (jfdaniel07) user
2) There is no need to mention "servlet" in the url .It may be as follows,
http://localhost:8080/onjava/login
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
1) servlet mapping is missing as mentioned by (jfdaniel07) user
2) There is no need to mention "servlet" in the url .It may be as follows,
http://localhost:8080/onjava/login
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
techkar
![]() |
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Dev-C++ - [Build Error] [main.o] Error 1 (C++)
- Can't Open Control Panel (Windows NT / 2000 / XP / 2003)
- network segmentation (Network Security)
- 'Unable to access jarfile' (Java)
- Media Player 10 owner needs help! (Windows Software)
- Layout help and DW (Site Layout and Usability)
- need help to make path for a line (C++)
Other Threads in the JSP Forum
- Previous Thread: Class on class inside package
- Next Thread: urgent need!! in jsp


Linear Mode