当前位置: 技术问答>java相关
这一句import javax.servlet.*;在书上说可以,为什么在我用EDITPLUS 编译时出错,?,应怎么办?(出错信息如内)
来源: 互联网 发布时间:2015-10-03
本文导语: ---------- COMPLIE JAVA ---------- servletToJsp.java:1: package javax.servlet does not exist import javax.servlet.*; ^ servletToJsp.java:2: package javax.servlet.http does not exist import javax.servlet.http.*; ^ servletToJsp.java:4: cannot resolve symbol symbol :...
---------- COMPLIE JAVA ----------
servletToJsp.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
servletToJsp.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
servletToJsp.java:4: cannot resolve symbol
symbol : class HttpServlet
location: class servletToJsp
public class servletToJsp extends HttpServlet {
^
servletToJsp.java:6: cannot resolve symbol
symbol : class HttpServletRequest
location: class servletToJsp
public void doGet (HttpServletRequest request,
^
servletToJsp.java:7: cannot resolve symbol
symbol : class HttpServletResponse
location: class servletToJsp
HttpServletResponse response) {
^
servletToJsp.java:12: cannot resolve symbol
symbol : method getServletConfig ()
location: class servletToJsp
getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request, response);
^
6 errors
Normal Termination
servletToJsp.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
servletToJsp.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
servletToJsp.java:4: cannot resolve symbol
symbol : class HttpServlet
location: class servletToJsp
public class servletToJsp extends HttpServlet {
^
servletToJsp.java:6: cannot resolve symbol
symbol : class HttpServletRequest
location: class servletToJsp
public void doGet (HttpServletRequest request,
^
servletToJsp.java:7: cannot resolve symbol
symbol : class HttpServletResponse
location: class servletToJsp
HttpServletResponse response) {
^
servletToJsp.java:12: cannot resolve symbol
symbol : method getServletConfig ()
location: class servletToJsp
getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request, response);
^
6 errors
Normal Termination
|
你的CLASSPATH中有包含servlet吗?你没有该包
|
在你的classpath中包含servlet.jar,tomcat等服务器里都有这个jar文件的