Hi Folks:
I am trying to compile/run the below java servlet. We are using websphere 6.0.2.19.
1. How can I deploy a single java class like the one below?
2. When I try to compile with:
'javac HelloServlet.java' I get error:
I think above error is related to me not specifying the correct classpath to imported classes. But how am I suppose to know the right classpath to use?
Thanks!!!
I am trying to compile/run the below java servlet. We are using websphere 6.0.2.19.
1. How can I deploy a single java class like the one below?
2. When I try to compile with:
'javac HelloServlet.java' I get error:
Code:
HelloServlet.java:16: cannot resolve symbol
symbol : class HttpServlet
location: class HelloServlet
public class HelloServlet extends HttpServlet
I think above error is related to me not specifying the correct classpath to imported classes. But how am I suppose to know the right classpath to use?
Thanks!!!
Code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloServlet extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>Hello</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1>Hello World</H1>\n" +
"</BODY></HTML>");
}
}