Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Mapping  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Author and ninkuma
Marshal
Posts: 66685
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your form action is incomplete. It needs to be in the format:

/contextpath/servletmapping
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
orion asd
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

Thanksalot it worked after adding the contextpath.

Thanks
Orion
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!