亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

JSP學習中在使用useBean時,class報錯。 cannot be resolved to a type

JSP學習中在使用useBean時,class報錯。 cannot be resolved to a type

<%@?page?language="java"?import="java.util.*"?contentType="text/html;?charset=utf-8"%> <%@?page?import="Math.Box"?%> <% String?path?=?request.getContextPath(); String?basePath?=?request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"> <html> ??<head> ????<base?href="<%=basePath%>"> ???? ????<title>My?JSP?'index.jsp'?starting?page</title> <meta?http-equiv="pragma"?content="no-cache"> <meta?http-equiv="cache-control"?content="no-cache"> <meta?http-equiv="expires"?content="0">???? <meta?http-equiv="keywords"?content="keyword1,keyword2,keyword3"> <meta?http-equiv="description"?content="This?is?my?page"> <!-- <link?rel="stylesheet"?type="text/css"?href="styles.css"> --> ??</head> ?? ??<body> ?? <jsp:useBean?id="box"?class="Math.Box"?scope="page"></jsp:useBean> ?? <h1>普通方式顯示javabeans</h1> ??</body> </html>java代碼package?Math; public?class?Box?{ private?int?length; private?int?width; private?int?height; public?Box()?{ } public?int?getLength()?{ return?length; } public?void?setLength(int?length)?{ this.length?=?length; } public?int?getWidth()?{ return?width; } public?void?setWidth(int?width)?{ this.width?=?width; } public?int?getHeight()?{ return?height; } public?void?setHeight(int?height)?{ this.height?=?height; } }在useBean的class報錯:?cannot be resolved to a type強行運行報錯Unable to compile class for JSP:The server encountered an internal error that prevented it from fulfilling this request.
查看完整描述

1 回答

已采納
?
安靜_天空

TA貢獻11條經驗 獲得超3個贊

我運行了一下你的代碼,把Math改個名字就可以正常運行~我想可能是math是一個java.util中的類,類式與關鍵字吧~

查看完整回答
1 反對 回復 2016-04-04
  • 1 回答
  • 0 關注
  • 2496 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號