初学,想写个最简单的bean,老是报同一个错

fyzeng 2004-10-26 07:02:46
换了几个例子,报的都是同一句错
就是这句:<jsp:useBean id="s" scope="page" class="hello"/>

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /hello.jsp
Generated servlet error:
hello cannot be resolved or is not a type

An error occurred at line: 2 in the jsp file: /hello.jsp
Generated servlet error:
hello cannot be resolved or is not a type

An error occurred at line: 2 in the jsp file: /hello.jsp
Generated servlet error:
hello cannot be resolved or is not a type
...全文
119 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
micker 2004-10-26
  • 打赏
  • 举报
回复
晕,找不到类啊!你看看你的class="hello"给确定对了,有包的要加上去啊,
zhuxr2004 2004-10-26
  • 打赏
  • 举报
回复
hello这个类里应该建在包的下面.
就是在java程序最顶上加一句话package xxx;
然后在/web-inf/classs/下面建目录xxx.把class文件拷贝进去.
jsp改为:
<jsp:useBean id="s" scope="page" class="xxx.hello"/>
重新运行ok

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧