各位朋友,我是个初学jsp的新手,请各位帮帮忙,我用JCreator执行这个servlet总会有很多的错误,执行别的servlet也会有类似的错误,谁能给我解释一下阿!代码如下:
package test;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Test extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out=response.getWriter();
out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
out.flush();
}
}
错误如下:
C:\test\Test.java:2: illegal character: \12288
import java.io.IOException;
^
C:\test\Test.java:2: illegal character: \12288
import java.io.IOException;
^
C:\test\Test.java:3: illegal character: \12288
import java.io.PrintWriter;
^
C:\test\Test.java:3: illegal character: \12288
import java.io.PrintWriter;
^
C:\test\Test.java:4: illegal character: \12288
import javax.servlet.ServletException;
^
C:\test\Test.java:4: illegal character: \12288
import javax.servlet.ServletException;
^
C:\test\Test.java:5: illegal character: \12288
import javax.servlet.http.HttpServlet;
^
C:\test\Test.java:5: illegal character: \12288
import javax.servlet.http.HttpServlet;
^
C:\test\Test.java:6: illegal character: \12288
import javax.servlet.http.HttpServletRequest;
^
C:\test\Test.java:6: illegal character: \12288
import javax.servlet.http.HttpServletRequest;
^
C:\test\Test.java:7: illegal character: \12288
import javax.servlet.http.HttpServletResponse;
^
C:\test\Test.java:7: illegal character: \12288
import javax.servlet.http.HttpServletResponse;
^
C:\test\Test.java:8: illegal character: \12288
public class Test extends HttpServlet
^
C:\test\Test.java:8: illegal character: \12288
public class Test extends HttpServlet
^
C:\test\Test.java:10: illegal character: \12288
protected void doGet(HttpServletRequest request, HttpServletResponse response)
^
C:\test\Test.java:10: illegal character: \12288
protected void doGet(HttpServletRequest request, HttpServletResponse response)
^
C:\test\Test.java:11: illegal character: \12288
throws ServletException, IOException
^
C:\test\Test.java:11: illegal character: \12288
throws ServletException, IOException
^
C:\test\Test.java:13: illegal character: \12288
PrintWriter out=response.getWriter();
^
C:\test\Test.java:13: illegal character: \12288
PrintWriter out=response.getWriter();
^
C:\test\Test.java:14: illegal character: \12288
out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
^
C:\test\Test.java:14: illegal character: \12288
out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
^
C:\test\Test.java:15: illegal character: \12288
out.flush();
^
C:\test\Test.java:15: illegal character: \12288
out.flush();
^
C:\test\Test.java:16: illegal character: \12288
}
^
C:\test\Test.java:16: illegal character: \12288
}
^
C:\test\Test.java:17: illegal character: \12288
}
^
C:\test\Test.java:17: <identifier> expected
}
^
28 errors