当前位置: 技术问答>java相关
在JSP中使用JAVABEAN时遇到的错误,谢谢
来源: 互联网 发布时间:2015-08-27
本文导语: 我照着书编了一个JAVABEAN(HitCounter.java,放在RESIN目录的WIN-INF/class下): public class HitCountBean implements Serializable { } 然后在HitCounter.jsp中使用它,如下: ... This page has had times 可是用resin编译时提示:com.caucho.js...
我照着书编了一个JAVABEAN(HitCounter.java,放在RESIN目录的WIN-INF/class下):
public class HitCountBean implements Serializable
{
}
然后在HitCounter.jsp中使用它,如下:
...
可是用resin编译时提示:com.caucho.jsp.JspParseException: Note: sun.tools.javac.Main has been deprecated. /test/HitCounter.jsp:2: Class _test.HitCountBean not found. HitCountBean counter; ^ /test/HitCounter.jsp:4: Class _test.HitCountBean not found. counter = (HitCountBean) application.getAttribute("counter"); ^ /test/HitCounter.jsp:6: Class _test.HitCountBean not found. counter = new HitCountBean(); ^ /test/HitCounter.jsp:3: Variable counter may not have been initialized. counter.setNewSession( session.isNew() ); ^ /test/HitCounter.jsp:15: Class _test.HitCountBean not found. out.print(((HitCountBean) pageContext.findAttribute("counter")).getHits()); ^ /test/HitCounter.jsp:16: Class _test.HitCountBean not found. out.print(((HitCountBean) pageContext.findAttribute("counter")).getStartTime()); ^ 6 errors, 1 warning
这是怎么回师?怎么会不存在呢?
谢谢
public class HitCountBean implements Serializable
{
}
然后在HitCounter.jsp中使用它,如下:
...
This page has had
times
可是用resin编译时提示:com.caucho.jsp.JspParseException: Note: sun.tools.javac.Main has been deprecated. /test/HitCounter.jsp:2: Class _test.HitCountBean not found. HitCountBean counter; ^ /test/HitCounter.jsp:4: Class _test.HitCountBean not found. counter = (HitCountBean) application.getAttribute("counter"); ^ /test/HitCounter.jsp:6: Class _test.HitCountBean not found. counter = new HitCountBean(); ^ /test/HitCounter.jsp:3: Variable counter may not have been initialized. counter.setNewSession( session.isNew() ); ^ /test/HitCounter.jsp:15: Class _test.HitCountBean not found. out.print(((HitCountBean) pageContext.findAttribute("counter")).getHits()); ^ /test/HitCounter.jsp:16: Class _test.HitCountBean not found. out.print(((HitCountBean) pageContext.findAttribute("counter")).getStartTime()); ^ 6 errors, 1 warning
这是怎么回师?怎么会不存在呢?
谢谢
|
HitCounter.jsp放到doc下
HitCounter.java编译好后
放到docWEB-INFclasses下一定好使
有无package?
HitCounter.java编译好后
放到docWEB-INFclasses下一定好使
有无package?
|
第一个文件名您不会真的存为test.java了吧?
(HitCountBean.java)
我测了,没有问题
(HitCountBean.java)
我测了,没有问题