逍遥热血:cannot find message resources under key org.apache.struts.action.message 问题解决 - yhaind@126的日志 - 网易博客

来源:百度文库 编辑:九乡新闻网 时间:2024/05/06 14:10:59

在学习logic标签的iterate时,老是报cannot find message resources under key org.apache.struts.action.message 的错:

源代码如下:

<%
 HashMap hp = new HashMap();
 String veg[] = {"tomato","pepper"};
 String fruit[] = {"banana","apple","pair","orange"};
 String flowers[] = {"chrysanthemum","rose"};
 String trees[] = {"willow"} ;
 
 hp.put("vegetable", veg);
 hp.put("fruit", fruit);
 hp.put("flowers", flowers);
 hp.put("trees", trees);
 
 request.setAttribute("hasmap",hp);
%>
element1" name="hasmap" indexId="ind1" >
    ind1"/>...element1" property="key"/>

    element1" property="value" id="element2">
       element2"/>

   

解决办法:

上面代码是正确的。只是web.xml的设置有问题,在使用struts的标签时,比如bean标签,有时会发生这个错误。

错误原因:
  web.xml中配置缺失:
   
      application
      ApplicationResources
   

造成原因:可能是JBuilder造成的,呵呵
解决方法:添加上,位置如下:
   
    action
    org.apache.struts.action.ActionServlet
   
      config
      /WEB-INF/struts-config.xml
   

   
      debug
      2
   

   
      application
      ApplicationResources
   

    2