<html:errors/> 应该放到form里
其实这种非空校验可以用javascript,节约服务器的资源

解决方案 »

  1.   

    不是说<html:errors/>可以放在任何位子,既可以放表单里也可以放在表单外的啊?
      

  2.   

    同意,用javascript验证这种东西较好,避免提交一次,浪费资源
      

  3.   

    new ActionError("不能为空!"));应为 new ActionError("errors.abc"));在 ApplicationResources.properties中
      error.abc=不能为空!
      

  4.   

    支持chocolate.建议好好看看流程,再决定放在哪里。
      

  5.   

    <action-mappings>
        <action input="/jsp1.jsp" name="tActionForm" path="/tAction" scope="request" type="errortest.tAction" validate="false">
          <forward name="succe" path="/jsp2.jsp"/>
        </action>
    </action-mappings>
    如果使用 actionForm 中的 validate 方法校验表单, 应该在 action-mapping 中设置 validate="false" 。如果 validate="true" , struts 会使用 validator 校验框架进行表单验证。
      

  6.   

    new ActionError("不能为空!"));应为 new ActionError("errors.abc"));在 ApplicationResources.properties中
      error.abc=不能为空!