Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
I am using JSDK2.1. What classpath shall I set to compile my servlet programs.
Please help me in this regard.
------------------
Susa
 
sai
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Soudarsanan:
[B]I am using JSDK2.1. What classpath shall I set to compile my servlet programs.
i hope that u hava path for jdk1.2.2
set path = %path%;c:\jsdk2.1\src;
set classpath = %classpath%;c:\jsdk2.1\src;c:\javawebserver2.0\lib;
 
sai
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Soudarsanan:
[B]I am using JSDK2.1. What classpath shall I set to compile my servlet programs.
i hope that u hava path for jdk1.2.2
set path = %path%;c:\jsdk2.1\src;
set classpath = %classpath%;c:\jsdk2.1\src;c:\javawebserver2.0\lib;
if any problem mail me gksai10@yahoo.com
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
I am unable to compile my program even after adding those classpaths. The following is the code
import java.io.*;
import javax.servlet.*;
public class FirstSer extends GenericServlet{
public void init(javax.servlet.ServletConfig sc) throws ServletException{
super.init(sc);
}
public void service(ServletRequest req, ServletResponse res){
try {
PrintWriter pw = res.getWriter();
res.setContentType("text/HTML");
pw.println("hello this is my first servlet ...");
pw.flush();
}
catch(Exception e){
}
}
public void destroy(){
super.destroy();
}
}
i get the following error when i compile
FirstSer.java:2: Package javax.servlet not found in import.
import javax.servlet.*;
^
FirstSer.java:4: Superclass GenericServlet of class FirstSer not found.
public class FirstSer extends GenericServlet{
^
2 errors
Please help me

------------------
Susa
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Try using :
extends HttpServlet

in doGet/ doPost use parameters :
HttpServletRequest request, HttpServletResponse response

and import :

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic