我的jsp:<html:messages id="message" property="filename" message="true">
              <bean:write name="message"/>             
            </html:messages>
 
   action:if(filename.indexOf(".txt") < 0) {
      actionMessages.add("filename", new ActionMessage("filename is not textfile",filename));
      saveMessages(request, actionMessages);
      System.out.println("---filename is not textfile---");
      return (new ActionForward(mapping.getInput()));
    }运行后错误信息:root cause javax.servlet.jsp.JspException: Cannot find bean message in any scope
org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:992)
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)
org.apache.jsp.index_jsp._jspx_meth_bean_write_0(org.apache.jsp.index_jsp:260)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:143)请各位路过的达人看看

解决方案 »

  1.   

    大哥 你配置 .properties了吗?
      

  2.   

    你的Action写的有问题啊,既然massage不在任何cope内,那就说明在jsp页面就根本没有.
    这样的话,就是你Action里面根本就没有把massage保存到cope内.你再检查检查
      

  3.   

    properties文件也配过了
    html:messages是遍历ActionMessages和ActionErrors对象的,message这里只是一个代号而已
    我的action
         public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,
                           HttpServletResponse response) throws Exception{    String dir=servlet.getServletContext().getRealPath("/upload");
        MessageResources messages=getResources(request);
        ActionMessages errors=new ActionMessages();
        HttpSession session=request.getSession();    fileform=(FileForm)form;
        formfile= fileform.getFormfile();
        filename=formfile.getFileName();    /*if((filename==null)||(filename.equals(""))||(filename.length()<1)){
          actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("filename is null"));
          saveMessages(request,actionMessages);
          System.out.println("---filename is null---");
          return(new ActionForward(mapping.getInput()));
        }*/
        if(filename.indexOf(".txt") < 0) {
          errors.add("filename", new ActionMessage("filename is not textfile",filename));
          saveMessages(request, errors);
          System.out.println("---filename is not textfile---");
          return (new ActionForward(mapping.getInput()));
        }    filebean=new FileBean();
        filebean.setFilename(filename);    request.setAttribute("filebean",filebean);    is =formfile.getInputStream();
        System.out.println("----is-------");
        meth = new Method();
        meth.output(is,dir+"/"+filename);
        formfile.destroy();    return(mapping.findForward("success"));
      }
    }请楼上的达人指点