aspose file tools*
The moose likes Servlets and the fly likes Problem while connecting to a servlet from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem while connecting to a servlet from JSP" Watch "Problem while connecting to a servlet from JSP" New topic
Author

Problem while connecting to a servlet from JSP

Tushar Bhujbal
Greenhorn

Joined: Jan 01, 2013
Posts: 4
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

Joined: May 22, 2012
Posts: 867
    
    5
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

Joined: Jan 01, 2013
Posts: 4
@Ivan :
Thank you...it worked "/" in the action was giving problem apart from attribute value
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem while connecting to a servlet from JSP