近日在写一个进行自动回帖的client程序,使用了httpunit工具的webform,由于bbs上的form有onsubmit的event限制,准备overridden webform的submit方法。随后自己创建一个类去集成webform,代码如下:
/*
* Created on 2005-6-16
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.gs.httpbbsclient;import java.io.IOException;import org.xml.sax.SAXException;import com.meterware.httpunit.SubmitButton;
import com.meterware.httpunit.WebForm;
import com.meterware.httpunit.WebResponse;/**
* @author harrison
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class WebFormExtends extends WebForm {
/* (non-Javadoc)
* @see com.meterware.httpunit.WebForm#doFormSubmit(com.meterware.httpunit.SubmitButton)
*/
WebResponse doFormSubmit(SubmitButton arg0) throws IOException,SAXException {
// TODO Auto-generated method stub
return submitRequest( null, getRequest( arg0 ) );
}
}
由于父类webform没有自己的构造函数(使用object的缺省构造函数),此时eclipse提示:implicit super constructor WebForm() is undefined for default constructor , must define an explicit constructor很疑惑,随后自己写了一个例子:public class aa { public static void main(String[] args) {
}
}================================================================public class bb extends aa { public static void main(String[] args) {
}
}=================================================================public class cc extends bb { public static void main(String[] args) {
}
}随后编译自己的验证例子,没有发现任何异常。很是疑惑,特此提出,大家讨论讨论。
/*
* Created on 2005-6-16
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.gs.httpbbsclient;import java.io.IOException;import org.xml.sax.SAXException;import com.meterware.httpunit.SubmitButton;
import com.meterware.httpunit.WebForm;
import com.meterware.httpunit.WebResponse;/**
* @author harrison
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class WebFormExtends extends WebForm {
/* (non-Javadoc)
* @see com.meterware.httpunit.WebForm#doFormSubmit(com.meterware.httpunit.SubmitButton)
*/
WebResponse doFormSubmit(SubmitButton arg0) throws IOException,SAXException {
// TODO Auto-generated method stub
return submitRequest( null, getRequest( arg0 ) );
}
}
由于父类webform没有自己的构造函数(使用object的缺省构造函数),此时eclipse提示:implicit super constructor WebForm() is undefined for default constructor , must define an explicit constructor很疑惑,随后自己写了一个例子:public class aa { public static void main(String[] args) {
}
}================================================================public class bb extends aa { public static void main(String[] args) {
}
}=================================================================public class cc extends bb { public static void main(String[] args) {
}
}随后编译自己的验证例子,没有发现任何异常。很是疑惑,特此提出,大家讨论讨论。
public aa(String haha){}其他不变。
bb就会报错了,编译你都过不去。