• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Configure to include servlet problem

 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi I just started using java web service and is having problem running servlets.
I configure my web.xml file to look like this
<?xml version="1.0"?>
<web-app 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">
<!-- General description of the PM Application -->
<display-name>Application</display-name>
<description>
This is the Java application
</description>
<servlet>
<display-name>MercProServlet</display-name>
<servlet-name>MercProServlet</servlet-name>
<servlet-class>MercProServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MercProServlet</servlet-name>
<url-pattern>/MercProServlet</url-pattern>
</servlet-mapping>
</web-app>

I put the servlet in dir
D:\jwstutorial13\examples\web\scrmypm\build\WEB-INF\classes

I try to invoke the servlet frm a form ie
<FORM method="post" action="/MercProServlet">
but it return resource not available
my jsp is in D:\jwstutorial13\examples\web\scrmypm\build
Using jsp with beans seems to be working fine.
What am I doing wrong? Help.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is more like servlet related problem, moving this thread to the Servlets Forum where you may get some help.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Never never never try to use a class not in a defined package in serious servlets or JSP work. The JVM may be trying to load it from the "current directory" - something you have no control over. Define a package, put the compiled class in the right place according to the package.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic