日期:2014-05-16  浏览次数:20393 次

jsp导入自定义类报错
自定义类:(能编译能运行)
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。

请高手指教。