2013-10-23 160 views
0

我在Servlet類獲得編譯錯誤試圖編譯程序..錯誤編譯Servlet程序

代碼:

import javax.servlet.*; 
import java.io.*; 
public class Servlet1 extends GenericServlet 
{ 
    pubilc void service(ServletRequest req,ServletResponse res)throws ServletException,IOException 
{ 
    PrintWriter out= res.getWriter(); 
    out.println("<html>"); 
    out.println("<body bgcolor=pink>"); 
    out.println("<h1> hello client <h1>"); 
    out.println("</body>"); 
    out.println("</html>");` 
} 
} 

錯誤:

<identifier> excepted 
    public void service (ServletRequereq, ServletRespons res) throws ServletException,IOException 
invalid method declaration; return type required 
    public void service(ServletRequereq, ServletResponse res)throws ServletException,IOException 

回答

3

小錯字:pubilc應該是public