0

hello everybody

first of all thanks to Daniweb and all its users for helping me lot of time.
now come to the problem
I've just started studying servlets 1 week back it was going well but i got one problrm when i try to run a packaged servlet code.

path to servlet (invoker servlet) class

D:\apache-tomcat-6.0.35\webapps\helloprogram\WEB-INF\classes\coreservlets\HelloServlet2.java

package coreservlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloServlet2 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 (2)</TITLE></HEAD>\n" +
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1>Hello (2)</H1>\n" +
                "</BODY></HTML>");
  }
}

URL which i entered to run this in browser

http://localhost:8080/helloprogram/servlet/coreservlets.HelloServlet2

the above code is working finely when i run this without package by putting .class file in classes folder of above.

i also set my classpath in environtment var

CLASSPATH=D:\apache-tomcat-6.0.35\webapps\helloprogram\WEB-INF\classes\coreservlets

please help me and ask me if any more information required to solve my problem.
Thanks once again to all daniweb family

Edited by aman rathi: forgot one line to copy in code which acctually is in my code

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by anand01
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.