File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes help needed..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "help needed....." Watch "help needed....." New topic

help needed.....

arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
I have following JSP in tomcat:
<title> test </title>
<script language="JavaScript">
// code
// code
// code for when sb. presses update button.
<a href="abc"> xyz </a>
I have link "xyz" which calls servlet "abc". Servlet abc simply prints out a line. But when I click on the link, it gives error Page cannot be found. I have servlet registered with tomcat.
Other servlets registered with tomcat are working fine. I am not able to figure out what the problem is with this new Servlet. If sb. could figure out the problem, that will be great.
Code of the servlet abc:
import java.lang.*;
import java.util.*;
import javax.servlet.http.*;
import javax.servlet.*;
import java.sql.* ;
public class abc extends HttpServlet{
public void doGet( HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException {

PrintWriter out = response.getWriter();
out.println(" inside servlet ");

}//doGet ends
}// class ends
thanks a lot in advance.
Jimi Rock
Ranch Hand

Joined: Feb 19, 2001
Posts: 134
What is the URL that is provided by your link that is supposed to call the servlet?
I think that this is your first servlet...
try the following:
1.put the *.class files of your servlet in the following path:
2.your link that calls the servlet needs to have the following
I hope that this will work,
arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
i am putting my servlets in c:\tomcat\webapps\myfolder\web-inf\classes.
url i am giving is:
all other servlets are working the same way. but this one is not. i was wondering if there was some problem in the JSP, i have given above.
let me know where i am missing.
thanks for the reply
Jimi Rock
Ranch Hand

Joined: Feb 19, 2001
Posts: 134
no problem with your code. I have tried it just to be sure...
it is working with me, and the servlet prints "inside servlet"! I have put the class in the same path I have specified. then I have changed the url as follows:
<a href="http://localhost:8080/examples/servlet/abc"> xyz </a>
just try it...
arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
i got the problem, didn't put my application name in the href.
terrible mistake !!
anyway thanks for ur help and checking up my code.
I agree. Here's the link:
subject: help needed.....
It's not a secret anymore!