分析:既然知道form为null,说明,能够进入到action里面去,为什么为空呢?可能性最大的一个原因,就是:formbean没有和struts中的action配置文件关联起来。
1、检查,struts的配置文件struts-config.xml中的form-bean配置有没有错。
<form-bean name="loginForm" type="com.qbz.struts.form.LoginForm" />
2、检查,struts的配置文件struts-config.xml中的action中的配置文件有没有错。(检查一下有没有name=”loginForm(上面formbean定义的值)”)
<action-mappings>
<action
parameter="op"
path="/login"
name="loginForm"
type="com.qbz.struts.action.LoginAction"
>
<set-property property="cancellable" value="true" />
<forward name="login" path="/index.jsp"></forward>
</action>
</action-mappings>