一个向下转型问题
actionform是个父类,为什么可以直接向下转型到RegisterForm
public class RegisterForm extends ActionForm {。。。。}
public class RegisterAction extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) {
// ○1 将form 转型为RegisterForm
RegisterForm rf = (RegisterForm) form;
String username = rf.getUsername();
String password1 = rf.getPassword1();
String password2 = rf.getPassword2();
ActionForward forward = new ActionForward();
.....
}