今天調別人的代碼發現錯誤如下:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 8 in the jsp file: /getStudent.jsp student cannot be resolved to a type 5: <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 6: <title>學生</title> 7: </head> 8: <jsp:useBean id="student" scope="page" class="student"/> 9: <body bgcolor="#0099FF" text="#FFFFFF" link="#33FF00"> 10: <p> 11: <%
說usebean無法聯接class的student類,網上查找資料說,要寫對類路徑,必須加上這個類的包名,但是我看這個類的確直接在src下
默認的包下面新建的類,並沒有其他的包名,沒辦法,後來加了個包名後,就可以訪問這個getstudent.jsp頁面了。難道usebean必須
加包名才能正確使用類嗎。這裏寫下備後面有何我遇到相同情況的兄弟查閱,如有高手請賜教。