jsp调用javabean出现错误HTTP Status 500 - Unable to compile class for JSP

时间:2021-06-20 02:22:45

HTTP Status 500 - Unable to compile class for JSP:

 

type Exception report

message Unable to compile class for JSP:

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: 11 in the jsp file: /index.jsp
User cannot be resolved to a type
8: <title>Insert title here</title>
9: </head>
10: <body>
11: <jsp:useBean id="user" class="User"></jsp:useBean> 解决办法:
新建class的时候不选择默认的包,而是自己建立一个包
<jsp:useBean id="user" class="demo.User"></jsp:useBean>