This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "help needed....." Watch "help needed....." New topic
Author

help needed.....

arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
I have following JSP in tomcat:
<html>
<head>
<title> test </title>
<script language="JavaScript">
// code
</script>
</head>
<table>
// code
<form>
// code for when sb. presses update button.
<a href="abc"> xyz </a>
</form>
</table>
</html>
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.* ;
import java.io.*;
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
Arpit,
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:
c:\tomcat\webapps\examples\web-inf\classes
2.your link that calls the servlet needs to have the following
URL:
http://localhost:8080/examples/servlet/YourServletClassName
I hope that this will work,
Regards,
Mac.
arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
jimi
i am putting my servlets in c:\tomcat\webapps\myfolder\web-inf\classes.
url i am giving is:
http:\\localhost:8080\servlet\myservlet
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
arpit
Jimi Rock
Ranch Hand

Joined: Feb 19, 2001
Posts: 134
arpit,
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...
Regards,
mac.
arpit singla
Ranch Hand

Joined: Jun 18, 2001
Posts: 66
jimi
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: help needed.....
 
Similar Threads
Servlet -Download Jar file
A problem in executing the servlet
Is SSI supported on tomcat
Pl help me with this href portion in this code
Servlet Problems