Beginner Servlet Question

From: Sally Mayne (nospam_at_nospam.com)
Date: 10/19/03

  • Next message: Murat G.: "J2EE and File"
    Date: Sun, 19 Oct 2003 05:34:44 GMT
    
    

    Hi:

    I am just starting on Servlets and I haven't got too far. I can't seem to
    run the program.

    System: WinXP, Tomcat 4.1.27

    The servlet file is called DontPanic.java - the code is given at the botton
    of this email.

    The steps I took are:

    - I placed the java servlet in C:\Program Files\Apache Group\Tomcat
    4.1\webapps\examples\WEB-INF\classes
    - I attempted to run this servlet by typing: javac - classpath C:\Program
    Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar DontPanic.java
    - I received the error message :"javac: invalid flag: Files/Apache""

    What have I done wrong - this has been puzzling me for most of today :(

    The code for DontPanic.java:

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    public class DontPanic {

      public void doGet(
       HttpServletRequest request,
       HttpServletResponse response
       )throws IOException, ServletException

       {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        out.println("<html>");
        out.println("<head>");
        out.println("<title>Don't Panic</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Don't Panic</h1>");
        out.println("</body>");
        out.println("</html>");
       }
    }


  • Next message: Murat G.: "J2EE and File"

    Relevant Pages

    • Re: Accessing the session object from a bean
      ... >>From a servlet... ... public class ProcessPOXLS extends BaseAppServlet { ... public void doProcessRequest (HttpServletRequest request, ... HttpSession session = request.getSession; ...
      (comp.lang.java.programmer)
    • Re: servlet getRequestDispatcher issue
      ... > I am having this issue with my Servlet, ... > public void doPost (HttpServletRequest request, ... > response); ...
      (comp.lang.java.programmer)
    • Re: JSP - Servlet - Session problem
      ... > The servlet will perform some processing and then redirect back to the ... > JSP with all the original form fields prefilled. ... > session before i use a response.sendRedirectto ... > public void service (HttpServletRequest request, ...
      (comp.lang.java.programmer)
    • Re: Tomcat + java.io.FileNotFoundException
      ... Application Server executes servlet and JSP in their own context (both ... > experience configuring tomcat. ... > 1- the File class uses paths relative to the working directory. ... However, classA is ...
      (comp.lang.java.programmer)
    • Re: A2LL ist tot...
      ... | mit Tomcat als Servlet Container. ... | # Bugs - You think you have a bug or there is a difference in behavior with another servlet container. ... | # Database - Getting tomcat to talk to a database. ...
      (de.talk.tagesgeschehen)