• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

login application in jsp-servlet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
Greenhorn
Posts: 29
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using /Login in form tags action attribute...
 
Abhijeet Jha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Kindly define servlet class and its mapping url in web.xml
like

 
Abhijeet Jha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 225
Spring Notepad Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67390
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the ServletsFaq. The action attribute should be the context path followed by the servlet path.
 
Ranch Hand
Posts: 171
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alas, poor Yorick, he knew this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic