文件LoginForm.java能顺利通过编译

 

package prj10;
import org.apache.struts.action.ActionForm;
public class LoginForm extends ActionForm{
	private String account;
	private String password;	
	public String getAccount(){
		return account;
	}
	public void setAccount(String account){
		this.account = account;
	}
	public String getPassword(){
		return password;
	}
	public void setPassword(String password){
		this.password = password;
	}
}

 

文件LoginAction.java不能通过编译

package prj10;
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;
public class LoginAction extends Action{
    @Override
	public ActionForward execute (ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception{
		LoginForm loginForm = (LoginForm)form; //此处编译出错
		String account = loginForm.getAccount();
		String password = loginForm.getPassword();
		String url = null;
		if(account.equals(password)){
			return new ActionForward("/loginSuccess.jsp");//登录成功
		}
		return new ActionForward("/loginFail.jsp");//登录失败
	}
}

这两个程序是登录页面的后台处理程序(struts1.2)

错误提示是LoginForm 找不到符号。