我在学习struts2的过程中,发现验证的时候,错误提示总在字段旁边,我如何设置才能让他在字段旁边不显示,而只显示在我写<s:actionerror />或<s:fielderror />的地方

解决方案 »

  1.   

    页面:<html:errors property="us" />
    Action:         ActionErrors errors=new ActionErrors();
    errors.add("zs",new ActionError("us.ccc"));
    saveErrors(request,errors);
    资源文件:us.ccc=<font color=red>错误提示</font>
      

  2.   

    楼上的意思是不是说把错误都赋给一个form中不存在的字段,然后指定这个字段显示位置
      

  3.   

    你是做后台验证还是前台ajax验证啊?
      

  4.   

    现在是做前台验证,但不是ajax的,希望点击提交的时候先做客户端验证
      

  5.   

    页面: <html:errors   property="us"   />
    Action:                   ActionErrors   errors=new   ActionErrors();
    errors.add("zs",new   ActionError("us.ccc"));
    saveErrors(request,errors);
    资源文件:us.ccc= <font   color=red> 错误提示 </font>
    ---------------------------------------------------------------------------------------------------------
    <html:errors   property="us"   />
    property=us,
    那你errors.add("zs",new   ActionError("us.ccc"));"zs"应该改成us
      

  6.   

    <html:erros property="us" />放到你想显示的地方不就好了
      

  7.   

    form的theme属性设成simple
    <s:form action="" theme="simple">