日期:2014-05-18  浏览次数:21374 次

简单问题出错:Enumeration cannot be resolved to a type
练习   request.getParameterNames()的用法,
html页面有个form,调用jsp页面
jsp页面
<%@   page   contentType= "text/html;charset=gbk "%>
<%@   page   import= "javax.util.* "%>
<%
request.setCharacterEncoding( "GBK ")   ;
Enumeration   enu   =   request.getParameterNames()   ;
%>
运行出错:
An   error   occurred   at   line:   5   in   the   jsp   file:   /demo08.jsp
Generated   servlet   error:
Enumeration   cannot   be   resolved   to   a   type

why?????????????????

------解决方案--------------------
这是你写的!
<%@ page contentType= "text/html;charset=gbk "%>
<%@ page import= "javax.util.* "%>

这是我写的:
<%@ page language= "java " import= "java.util.* " pageEncoding= "GBK "%>
这行就没用了request.setCharacterEncoding( "GBK ") ;

改改试试
------解决方案--------------------
<%@ page import= "javax.util.* "%>

改成

<%@ page import= "java.util.* "%>
------解决方案--------------------
你查一下JDK的文档就知道了,没有javax.util包,只有java.util

http://java.sun.com/j2se/1.5.0/docs/api/

------解决方案--------------------
你的jdk版本是不是太低了?