Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem while connecting to a servlet from JSP

 
Tushar Bhujbal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is already one topic in this forum for same topic but as it is locked I'm not able to add anything there..
If there is a way to do it sorry for this as I don't know.

I'm not able to call my servlet from JSP....
My directory structure is

TestApp
|---index.html (login page)
|---WEB-INF
---- |---web.xml
---- |---userLogged.jsp(shows on successful login)
---- |---classes
---- ----- |----LoginServlet.java
---- ----- |----UserBean.java
---- ----- |----UserDAO.java
---- ----- |----ConnectionManager.java

Here is the code of the <form> tag in index.jsp
<form action="LoginServlet" method="post">



Here is the code forom web.xml


When i click submit button "HTTP Status 404 - /TestApp/LoginServlet

Description : The requested resource is not available."
error is showing.

The error must be due to url/path mistake or something else which i'm not able to figure out.
Please help
 
Ivan Jozsef Balazs
Rancher
Posts: 972
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tushar Bhujbal wrote:
Here is the code of the <form> tag in index.jsp
<form action="LoginServlet" method="post">

<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/logserv</url-pattern>
</servlet-mapping>



The action of the form is "LoginServlet", which does not match the url-pattern.
 
Tushar Bhujbal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Ivan :
Thank you...it worked "/" in the action was giving problem apart from attribute value
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic