当前位置: 技术问答>java相关
javaServlet的一个问题。急!
来源: 互联网 发布时间:2015-03-06
本文导语: 我的一段代码: String url = "http://aa/testdir/jsp/bb/test.jsp"; ServletContext sc = getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); 编译的时候出现错误是什么原因呢? Properties.java:45: Class RequestDispatcher not fo...
我的一段代码:
String url = "http://aa/testdir/jsp/bb/test.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
编译的时候出现错误是什么原因呢?
Properties.java:45: Class RequestDispatcher not found in type declaration.
RequestDispatcher rd = sc.getRequestDispatcher(url);
^
Properties.java:45: Method getRequestDispatcher(java.lang.String) not found in i
nterface javax.servlet.ServletContext.
RequestDispatcher rd = sc.getRequestDispatcher(url);
String url = "http://aa/testdir/jsp/bb/test.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
编译的时候出现错误是什么原因呢?
Properties.java:45: Class RequestDispatcher not found in type declaration.
RequestDispatcher rd = sc.getRequestDispatcher(url);
^
Properties.java:45: Method getRequestDispatcher(java.lang.String) not found in i
nterface javax.servlet.ServletContext.
RequestDispatcher rd = sc.getRequestDispatcher(url);
|
no ,是要升级新的servlet api
|
import javax.servlet.RequestDispatcher;