自定义类:(能编译能运行)
package example5;
public class BicData{
private String weight = null;
private String size = null;
public BicData(String weight,String size){
this.weight=weight;
this.size=size;
}
public static void main(String args[]){
BicData bic=new BicData("a","b");
System.out.println(bic.weight+bic.size);
}
}
JSP代码
<%@ page import="example5.BicData" %>
<%
BicData bicc=new BicData("a","b");
out.println("e2e");
%>
报错:The constructor BicData(String, String) is undefined
把BicData("a","b")改成BicData(),就能看到输出哦e2e。
请高手指教。
package example5;
public class BicData{
private String weight = null;
private String size = null;
public BicData(String weight,String size){
this.weight=weight;
this.size=size;
}
public static void main(String args[]){
BicData bic=new BicData("a","b");
System.out.println(bic.weight+bic.size);
}
}
JSP代码
<%@ page import="example5.BicData" %>
<%
BicData bicc=new BicData("a","b");
out.println("e2e");
%>
报错:The constructor BicData(String, String) is undefined
把BicData("a","b")改成BicData(),就能看到输出哦e2e。
请高手指教。
本文探讨了一个关于JSP中使用自定义类时遇到的问题:当尝试使用带有两个参数的构造方法实例化类时出现错误。通过调整构造方法调用解决了问题,并成功输出了预期结果。
66

被折叠的 条评论
为什么被折叠?



