问题描述
如题: struts2 .xml 配置: <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><constant name="struts.custom.i18n.resources" value="messagesResource" /> <package name="orgStat" extends="default" namespace="/app/statistics"> <action name="orgAlAction!*" method="{1}" class="com.yxtech.hr.stat.orgAnalysis.action.OrgAnalysisAction"> <result name="hfList" type="json"> <param name="includeProperties"> dataRows.*, curPage,totalPages,totalRecords </param> <param name="noCache">true</param> <param name="ignoreHierarchy">false</param> </result> </action> </package></struts> 对应了Action 写了 2个 properties文件:OrgAnalysisAction_en_US.properties OrgAnalysisAction_zh_CN.properties 里面都已经配置好了相关 ============================================ 前台页面:<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%@ taglib prefix="s" uri="/struts-tags"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>My JSP 'DeptStatistics.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <%@ include file="/app/common/jsp/header_base.jsp"%> <%@ include file="/app/common/jsp/header_grid.jsp"%> <%@ include file="/app/common/jsp/header_easy_ui.jsp"%> <%@ include file="/app/common/jsp/header_ext.jsp"%> <script type="text/javascript" src="DeptStatistics.js"></script> <script type="text/javascript" src="<%=basePath%>js/public/windowtree/orgTree.js"></script> <% if(baseLang.equalsIgnoreCase("zh")) {%> <script type="text/javascript" src="<%=basePath %>app/Statistics/DeptStatistics_zh_CN.js"></script> <%}else{%> <script type="text/javascript" src="<%=basePath %>app/Statistics/DeptStatistics_en_US.js"></script> <% }%> <script > </script> </head> <body onload="showTime()"> <table width="100%" border="0" height="100%" cellspacing="0" cellpadding="0"> <tr> <td class="main_panel_topleft"> </td> <td class="main_panel_topcenter"><span><s:text name="stat.current"></s:text></span></td> <td class="main_panel_topright"> </td> </tr> <tr> <td height="174" class="main_panel_left"> </td> <td class="main_panel_center"> <div id="toolbar"> <ul> <li><a onclick="submitForm()"><span><img src="/HRMS/themes/client_skin/gray/images/toolbar_ico/zoom.png" border="0" /></span><s:text name="stat.Query"></s:text></a></li> <li><a onclick="resetFrom()"><span><img src="/HRMS/themes/client_skin/gray/images/toolbar_ico/application_get.png" border="0" /></span><s:text name="stat.clear"></s:text></a></li> </ul> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="seach_tabtit"><span><s:text name="stat.Query.conditon"></s:text> </span></td> </tr> </table> <form id="submitFrom" name="submitFrom" method="post"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="datalist_tab"><tr> <td width="10%" height="28" nowrap="nowrap" class="td_title"><s:text name="stat.Time.dimension"></s:text></td> <td width="23%"><select id="year"> <option value="0">--<s:text name="stat.Please.select"></s:text>--</option> </select></td> <td width="10%" height="35" nowrap="nowrap" class="td_title"><s:text name="stat.Organization.unit"></s:text></td> <td width="23%"> <input type='hidden' id='txtOrgId' /> <input type='hidden' id='orgFlag' /> <input type='text' id='txtOrgName'/> <img src="/HRMS/images/search2.gif" onclick="win.showTree()"></td> <td colspan="2" width="33%"></td> </tr> <tr style="display:none" id="hidtr"> <td height="35" colspan="6" align="left" class="toolbutton_td"> <span style="display:none;" id="hid"> <input type="radio" value="1" name="myDateTime" checked="checked"/><s:text name="stat.Year"></s:text> <input type="radio" value="2" name="myDateTime"/><s:text name="stat.half.year"></s:text> <input type="radio" value="3" name="myDateTime"/><s:text name="stat.Quarter"></s:text> <input type="radio" value="4" name="myDateTime"/><s:text name="stat.Month"></s:text></span> </td> </tr> <tr> <td height="35" colspan="6" class="toolbutton_td" id="hidtr2"> <span id="showType"></span> </td> </tr> </table> </form> <table id="gridTable"></table> <div id="gridPager"></div> </td> <td class="main_panel_right"> </td> </tr> <tr> <td class="main_panel_leftfoot"> </td> <td class="main_panel_footcenter"> </td> <td class="main_panel_rightfoot"> </td> </tr></table> </body></html> 打开页面就是 stat.Time.dimension 之类的
解决方案
需要加一个struts.properties文件吧,在文件里面写入struts.custom.i18n.resources=OrgAnalysisAction这里面这个OrgAnalysisAction就是你的properties文件名的前部分
解决方案二:
web.xml文件的配置呢?