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 Servlet Mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Servlet Mapping" Watch "Servlet Mapping" New topic
Author

Servlet Mapping

orion asd
Greenhorn

Joined: Mar 21, 2007
Posts: 2
Hi ,

I am new to java servlets I am getting The requested resource is not available.

I am having one mainpage.jsp where I am trying to submit using the form action"" and in web.xml proper servlet name and mapping is done.

Please let me know what is wrong with the below code in .jsp and web.xml

IN MainPage.jsp

<form action="databasedetails" method="post">

In this .jsp page when i click on submit button it is not calling the
servlet DBDetailsServlet...

and in web.xml

<servlet>
<servlet-name>DBDetailsServlet</servlet-name>
<servlet-class>com.abc.DBDetailsServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>DBDetailsServlet</servlet-name>
<url-pattern>/databasedetails</url-pattern>
</servlet-mapping>

Thanks in advance .
orion
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56152
    
  13

Your form action is incomplete. It needs to be in the format:

/contextpath/servletmapping


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"orion asd",
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
orion asd
Greenhorn

Joined: Mar 21, 2007
Posts: 2
Hi Bear,

Thanksalot it worked after adding the contextpath.

Thanks
Orion
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Servlet Mapping
 
Similar Threads
http status 404 The requested resource is not available.
Tompcat - calling servlet from JSP
setting up ACTION attribute of FORM element
servlet not found error
very very basic ques about using servlets