HTTP Status 500 - /calculator.jsp (line: 2, column: 0) The value for the useBean

捞一碗时光 2016-11-29 09:09:46
请教大神们这是个什么原因造成的呢
...全文
579 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
捞一碗时光 2017-02-23
  • 打赏
  • 举报
回复
谢谢啦
  • 打赏
  • 举报
回复
确认这个类是public,而且有默认构造函数
vswen5 2016-11-29
  • 打赏
  • 举报
回复
calculator.jsp 第二行错了 类没有引用好
ichavin 2016-11-29
  • 打赏
  • 举报
回复
jsp:bean 里面class里面要是完整的包名.类名,下面body里面的java代码也要用<% %>包起来
  • 打赏
  • 举报
回复
是不是bean没引入包。倒是把页面代码贴出来看看啊
  • 打赏
  • 举报
回复
<jsp:useBean scope="page" class="calculator.Calculator" id="calculator"> 这是完整的包名加类名?
SSHorSSM 2016-11-29
  • 打赏
  • 举报
回复
引用 4 楼 ZTouch 的回复:
页面代码如下: <%@ page contentType="text/html; charset=UTF-8"%> <jsp:useBean scope="page" class="calculator.Calculator" id="calculator"> <jsp:setProperty name="calculator" property="*"/> </jsp:useBean> <html> <head> <title>计算结果</title> </head> <body> try { String result=calculator.calculate(); out.println(calculator.getValue1()+calculator.getOper()+calculator.getValue2()+"="+result); out.println("<a href=calculator.html>返回</a>""); } catch(Exception e) { out.printLn(e.getMessage()); } </body> </html>
用<% %>把代码括起来试试
SSHorSSM 2016-11-29
  • 打赏
  • 举报
回复
引用 3 楼 fangmingshijie 的回复:
确认这个类是public,而且有默认构造函数
在JSP页面嵌套代码块,需要<% %>把代码括起来吧
捞一碗时光 2016-11-29
  • 打赏
  • 举报
回复
页面代码如下: <%@ page contentType="text/html; charset=UTF-8"%> <jsp:useBean scope="page" class="calculator.Calculator" id="calculator"> <jsp:setProperty name="calculator" property="*"/> </jsp:useBean> <html> <head> <title>计算结果</title> </head> <body> try { String result=calculator.calculate(); out.println(calculator.getValue1()+calculator.getOper()+calculator.getValue2()+"="+result); out.println("<a href=calculator.html>返回</a>""); } catch(Exception e) { out.printLn(e.getMessage()); } </body> </html>

58,454

社区成员

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

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