日期:2014-05-18 浏览次数:20769 次
//TestBean.java package test; public class TestBean{ private String name = null; public TestBean(String strName_p){ this.name=strName_p; } public TestBean(){ } public void setName(String strName_p){ this.name=strName_p; } public String getName(){ return this.name; } public int getRs(int a,int b) { return a+b; } } ------------------------------------------------- ///TestBean.jsp <%@ page import="test.TestBean" %> <html> <body> <center> <% TestBean testBean=new TestBean("This is a test java bean."); %> Java bean name is: <%=testBean.getName()%> The Res is: <%=testBean.getRS(23,25)%> </center> </body> </html> ------------------------------------------ 报错如下: An error occurred at line: 7 in the jsp file: /TestBean.jsp The method getRS(int, int) is undefined for the type TestBean