当前位置: 代码迷 >> Eclipse >> 怎么在Eclipse中编写JSP文件
  详细解决方案

怎么在Eclipse中编写JSP文件

热度:87   发布时间:2016-04-23 18:40:27.0
如何在Eclipse中编写JSP文件?
请问怎样在Eclipse中导入servlet.jar文件阿~~~
import   java.io.*;
import   javax.servlet.*;
import   javax.servlet.http.*;
import  

  public   class   ExampleServlet   extends   HttpServlet{
        public   void   doGet(   HttpServletRequest   request,   HttpServletResponse   response   ){
            try
                {
                    PrintWriter   out   =   response.getWriter();
                    String   output;
                    //Instruct   the   servlet   to   respond   with   html
                    response.setContentType(   "text/html "   );
                    output   =   " <html> <body> <head> <title> Example           Servlet </title> </head> Hello   World </body> </html> ";
                    //Print   the   response   to   the   Web   browser.
                    out.println(   output   );
                    //Close   the   Printwriter   object
                    out.close();
              }
            catch(   Exception   e)
              {  
                        //Print   any   exceptions   to   the   system   console.
                      System.err.println(   e.toString()   );
              }
        }
}

在import   javax....那里就是有错,好郁闷阿~~~

------解决方案--------------------
工程属性-> java build path-> libraries-> add External jar
  相关解决方案