1、先写了个Beans  里面有  name  password  属性,set  get 方法都有。
2.再写了个action   里面有 Beans 对象beans 。
3.用配置文件校验
4.前台用html想显示错误信息,不用标签库。
显示错误的地方用${errors.bean.name[0]} 无法显示错误信息,但是把 beans 直接写在action 里面显示正常${errors.name[0]}.....
在线等   beans 和action 分开写  不用标签库显示错误信息的方法

解决方案 »

  1.   

    struts2中有fieldError和ActionError两种 你看下API
      

  2.   

    数据校验的错误应该是fielderror
    <s:filederror fieldName="beans.name" />
    <s:filederror fieldName="beans.password" />
    记得是以列表的形式显示的, 因为一个字段上面可能会有多个错误!
      

  3.   

    用el的话  也是这样
    ${fieldErrors[beans.name][0]}
    ${fieldErrors[beans.password][0]}
    在property标签中式这么取的.!
    el能访问到valuestack中的属性,我想应该也是可以的.! 在struts2中没用过el!  LZ自己去试
      

  4.   

    我会struts1 对struts2也不是太了解。所以我不行啊,看看你的回复,我也可以学到不少东西
      

  5.   

    ${errors.bean.name[0]} 你得后台把值放到里面才能在前台显示出来
    例子
    ActionContext.getContext().put("message", "<font color='#0099CC'>恭喜您,添加上传广告成功!</font>");//设定页面返回信息