当前位置: 技术问答>java相关
求救:setProperty与getPropertity的问题!!!!!!!!!!!!
来源: 互联网 发布时间:2015-01-27
本文导语: 大家看下为啥这个程序不得运行啊? Counter Page Counter: 下面是BEAN原程序了: /////////TestBean.java :~ package test; import java.util.*; public class TestBean2 { int counter; public TestBean2() { counter=100; } p...
大家看下为啥这个程序不得运行啊?
Counter Page
Counter:
下面是BEAN原程序了:
/////////TestBean.java :~
package test;
import java.util.*;
public class TestBean2 {
int counter;
public TestBean2() {
counter=100;
}
public void setcounter(int iii) {
counter=iii;
}
public int getcounter() {
return counter;
}
}
//////end
还是我对PROPERTITY的理解有问题啊???????出错码如下:
####
####
java.lang.ClassCastException: test.TestBean
at jsp_servlet._jsp._testbean._jspService(_testbean.java:87)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:246)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Counter Page
Counter:
下面是BEAN原程序了:
/////////TestBean.java :~
package test;
import java.util.*;
public class TestBean2 {
int counter;
public TestBean2() {
counter=100;
}
public void setcounter(int iii) {
counter=iii;
}
public int getcounter() {
return counter;
}
}
//////end
还是我对PROPERTITY的理解有问题啊???????出错码如下:
####
####
java.lang.ClassCastException: test.TestBean
at jsp_servlet._jsp._testbean._jspService(_testbean.java:87)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:246)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
|
我已经按照你的程序在jdk1.3下进行编译,在tomcat下测试了,浏览器输出为:
Counter: 2
Counter: 2
|
你的bean的文件名怎么和类名不一样?
|
public class TestBean2 { //TestBean2------TestBean
int counter;
public TestBean2() { //TestBean2()------TestBean()
counter=100;
int counter;
public TestBean2() { //TestBean2()------TestBean()
counter=100;
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。