猿问

我用struts框架的时候,提示Cannot cast from ActionForm to user

package UserBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import Dao.UserDao;

public class AddUserAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		user u=(user)form;
		UserDao ud=new UserDao();
		ud.addUser(u);
		return mapping.findForward("list");
	}

}

user u=(user)form;怎么解决Cannot cast from ActionForm to user?求指点

qq_蝶恋花_9
浏览 2087回答 1
1回答

qq_莫非

注意你的user是否继承了ActionForm
随时随地看视频慕课网APP

相关分类

Java
我要回答