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

login application in jsp-servlet

Abhijeet Jha
Greenhorn

Joined: Jul 03, 2012
Posts: 3
I am developing a small login application in jsp and sevlets:

my servlet is Login.java and the source code is:




login.jsp source code:






i have created a package named LDA under src folder. In that LDA package my Login.java servlet resides.

I tried to run the login.jsp page but i am facing error:

HTTP Status 404 -

--------------------------------------------------------------------------------

type Status report

message

description The requested resource () is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.35

please help me out!!!
Aniket Khadke
Greenhorn

Joined: Jul 13, 2011
Posts: 29

try using /Login in form tags action attribute...
Abhijeet Jha
Greenhorn

Joined: Jul 03, 2012
Posts: 3
thanks for the help!!!
application ran succesfully....
but after i click on submit button i am facing following error:

HTTP Status 404 - /Login

--------------------------------------------------------------------------------

type Status report

message /Login

description The requested resource (/Login) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.35
Habeeb Shaikh
Ranch Hand

Joined: Nov 23, 2008
Posts: 48
hi,
Kindly define servlet class and its mapping url in web.xml
like

Abhijeet Jha
Greenhorn

Joined: Jul 03, 2012
Posts: 3
i have defined servlet mapping in web.xml as follow


<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" 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">
<display-name>LDA_Management</display-name>
<servlet>
<description>
</description>
<display-name>Login</display-name>
<servlet-name>Login</servlet-name>
<servlet-class>LDA.Login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/Login</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Abhijeet,

Welcome to JavaRanch.

Please either use <servlet-class>src.LDA.Login</servlet-class> in web.xml or put your Login.class in LDA package only (not in src folder).

It also depends how you have put your java files(.class) under webapp directory of your Servlet container (tomcat etc.)

--------
Regards
Ahmed
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

See the ServletsFaq. The action attribute should be the context path followed by the servlet path.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Anurag Verma
Ranch Hand

Joined: Mar 30, 2012
Posts: 124

First thing that i can see is the action attribute in your jsp (Bear has already mentioned about it), it should be Login with context path as prefix to it,

Second thing is that youy are overriding the service method which should not be done ever. (unless you are left with no other option, which is rare). in this case, even if you reach your servlet, the doPost() method won't be called, only service() will be executed & an empty response will be returned.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: login application in jsp-servlet