fork download
  1. package jp.co.insightech;
  2.  
  3. import java.io.*;
  4. import javax.servlet.*;
  5. import javax.servlet.http.*;
  6.  
  7. public class BBSServlet extends HttpServlet {
  8.  
  9. public void doGet(HttpServletRequest request, HttpServletResponse response)
  10. throws ServletException, IOException {
  11.  
  12.  
  13. String name = request.getParameter("name");
  14. String hobby = request.getParameter("hobby");
  15.  
  16. response.setContentType("text/html; charset=MS932");
  17.  
  18. PrintWriter out = response.getWriter();
  19. out.println("<html><head><title>掲示板</title></head>");
  20. out.println("<body><b>");
  21. out.println(name);
  22. out.println("</b>さんの趣味は<i>");
  23. out.println(hobby);
  24. out.println("</i>です");
  25. out.println("</body></html>");
  26. out.close();
  27. }
  28.  
  29. public void doPost(HttpServletRequest request, HttpServletResponse response)
  30. throws ServletException, IOException {
  31. doGet(request, response);
  32. }
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: error: class BBSServlet is public, should be declared in a file named BBSServlet.java
public class BBSServlet extends HttpServlet {
       ^
Main.java:4: error: package javax.servlet does not exist
import javax.servlet.*;
^
Main.java:5: error: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Main.java:7: error: cannot find symbol
public class BBSServlet extends HttpServlet {
                                ^
  symbol: class HttpServlet
Main.java:9: error: cannot find symbol
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                           ^
  symbol:   class HttpServletRequest
  location: class BBSServlet
Main.java:9: error: cannot find symbol
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                                                       ^
  symbol:   class HttpServletResponse
  location: class BBSServlet
Main.java:10: error: cannot find symbol
                        throws ServletException, IOException {
                               ^
  symbol:   class ServletException
  location: class BBSServlet
Main.java:29: error: cannot find symbol
        public void doPost(HttpServletRequest request, HttpServletResponse response)
                           ^
  symbol:   class HttpServletRequest
  location: class BBSServlet
Main.java:29: error: cannot find symbol
        public void doPost(HttpServletRequest request, HttpServletResponse response)
                                                       ^
  symbol:   class HttpServletResponse
  location: class BBSServlet
Main.java:30: error: cannot find symbol
                       throws ServletException, IOException {
                              ^
  symbol:   class ServletException
  location: class BBSServlet
10 errors
stdout
Standard output is empty