首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

关于Struts2资源文件的配备

2012-10-16 
关于Struts2资源文件的配置转载自:http://blog.csdn.net/Mount_here/archive/2009/02/03/3860700.aspx最近

关于Struts2资源文件的配置
转载自:http://blog.csdn.net/Mount_here/archive/2009/02/03/3860700.aspx

最近在玩Struts2时,发现Struts2的资源文件配置的几个有趣的问题,特地跑来给大家分享。

据Struts2的文档,当由action加载页面时资源文件的的搜索顺序为:

ActionClass.properties
Interface.properties (every interface and sub-interface)
BaseClass.properties (all the way to Object.properties)
ModelDriven's model (if implements ModelDriven), for the model object repeat from 1
package.properties (of the directory where class is located and every parent directory all the way to the root directory)
search up the i18n message key hierarchy itself
global resource properties
在了解这些后,我在struts.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.action.extension" value="do" />
    <constant name="struts.devMode" value="true" />
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
   
    <package name="practice" extends="struts-default">
       <action name="index" value="do" />
    <constant name="struts.devMode" value="true" />
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
   
    <package name="practice" extends="struts-default">
       <action name="index" />

热点排行