<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    夢幻之旅

    DEBUG - 天道酬勤

       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks

    Struts2的配置文件,有些配置在項目中還是很實用的

     

    struts.action.extension
               The URL extension to use to determine if the request is meant for a Struts action
                用URL擴展名來確定是否這個請求是被用作Struts action,其實也就是設置 action的后綴,例如login.do的'do'字。

    struts.configuration
               The org.apache.struts2.config.Configuration implementation class
                 org.apache.struts2.config.Configuration接口名

    struts.configuration.files
               A list of configuration files automatically loaded by Struts
                struts自動加載的一個配置文件列表

    struts.configuration.xml.reload
               Whether to reload the XML configuration or not
                是否加載xml配置(true,false)

    struts.continuations.package
                The package containing actions that use Rife continuations
                含有actions的完整連續的package名稱

    struts.custom.i18n.resources
               Location of additional localization properties files to load
                加載附加的國際化屬性文件(不包含.properties后綴)

    struts.custom.properties
               Location of additional configuration properties files to load
                加載附加的配置文件的位置


    struts.devMode
               Whether Struts is in development mode or not
                是否為struts開發模式

    struts.dispatcher.parametersWorkaround
               Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic
                 (某些版本的weblogic專用)是否使用一個servlet請求參數工作區(PARAMETERSWORKAROUND)

    struts.enable.DynamicMethodInvocation
               Allows one to disable dynamic method invocation from the URL
                 允許動態方法調用

    struts.freemarker.manager.classname
               The org.apache.struts2.views.freemarker.FreemarkerManager implementation class
                org.apache.struts2.views.freemarker.FreemarkerManager接口名

    struts.i18n.encoding
               The encoding to use for localization messages
                國際化信息內碼

    struts.i18n.reload
               Whether the localization messages should automatically be reloaded
                是否國際化信息自動加載

    struts.locale
               The default locale for the Struts application
                默認的國際化地區信息

    struts.mapper.class
               The org.apache.struts2.dispatcher.mapper.ActionMapper implementation class
                 org.apache.struts2.dispatcher.mapper.ActionMapper接口

    struts.multipart.maxSize
               The maximize size of a multipart request (file upload)
                multipart請求信息的最大尺寸(文件上傳用)

    struts.multipart.parser
               The org.apache.struts2.dispatcher.multipart.
               MultiPartRequest parser implementation for a multipart request (file upload)
               專為multipart請求信息使用的org.apache.struts2.dispatcher.multipart.MultiPartRequest解析器接口(文件上傳用)


    struts.multipart.saveDir
               The directory to use for storing uploaded files
                設置存儲上傳文件的目錄夾

    struts.objectFactory
               The com.opensymphony.xwork2.ObjectFactory implementation class
                com.opensymphony.xwork2.ObjectFactory接口(spring)

    struts.objectFactory.spring.autoWire
               Whether Spring should autoWire or not
                是否自動綁定Spring

    struts.objectFactory.spring.useClassCache
               Whether Spring should use its class cache or not
                是否spring應該使用自身的cache

    struts.objectTypeDeterminer
               The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class
                 com.opensymphony.xwork2.util.ObjectTypeDeterminer接口

    struts.serve.static.browserCache
       If static content served by the Struts filter should set browser caching header properties or not
                是否struts過濾器中提供的靜態內容應該被瀏覽器緩存在頭部屬性中

    struts.serve.static
               Whether the Struts filter should serve static content or not
                是否struts過濾器應該提供靜態內容

    struts.tag.altSyntax
               Whether to use the alterative syntax for the tags or not
                是否可以用替代的語法替代tags

    struts.ui.templateDir
               The directory containing UI templates
                UI templates的目錄夾

    struts.ui.theme
               The default UI template theme
                默認的UI template主題

    struts.url.http.port
               The HTTP port used by Struts URLs
                設置http端口

    struts.url.https.port
               The HTTPS port used by Struts URLs
                設置https端口

    struts.url.includeParams
               The default includeParams method to generate Struts URLs
               在url中產生 默認的includeParams


    struts.velocity.configfile
               The Velocity configuration file path
                velocity配置文件路徑

    struts.velocity.contexts
               List of Velocity context names
                velocity的context列表


    struts.velocity.manager.classname
               org.apache.struts2.views.velocity.VelocityManager implementation class
                org.apache.struts2.views.velocity.VelocityManager接口名

    struts.velocity.toolboxlocation
               The location of the Velocity toolbox
                velocity工具盒的位置
    struts.xslt.nocache
               Whether or not XSLT templates should not be cached
                是否XSLT模版應該被緩存

     

    1:在action中定義的變量,在jsp頁面中顯示用:<s:property value="變量名" />

    2:在頁面中實現自動增加的序號用iterator的statuts的index屬性 eg:

    <s:iterator value="#request.inOutAccountList" id="data" status="listStat">

    <s:property value="#listStat.index+1"/>

    </s:iterator>

    3:在action類中取得request和session對象的方法

    Map session = ActionContext.getContext().getSession();
    HttpServletRequest request = ServletActionContext.getRequest ();

    設置它們的值的方法

    session.put("operation", "add");
    request.setAttribute("name", name);

    頁面中取得它們的值:

    <s:property value="#session.operation"/>
    <s:property value="#request.name"/>

    4:頁面中奇偶行樣式不一樣的控制方法:

    <tr class="<s:if test='#listStat.odd == true '>tableStyle-tr1</s:if><s:else>tableStyle-tr2</s:else>" >

    5:單選框和復選框的使用方法

    1):可以設置默認選中值,注意list的值的設置,通過這種方式使key和value不一樣,這種方法比較常用(checkboxlist or radio)

    <s:radio name="uncarInsPolicy.policyStateCode"
    list="#{'5':'通過' , '2':'不通過'}"
    listKey="key"
    listValue="value"
    value='5'
    />

    2):這里的key和value的值是一樣的(checkboxlist or radio)

    <s:checkboxlist
    list="{'Red', 'Blue', 'Green'}"
    name="favoriteColor"/>

    6:struts2 中的標簽會生成類似由<tr><td></td></tr>構成的字串(具體什么標簽生成什么,可以查看生成后的頁面的源代碼)如果不限制這些多余代碼的生成,頁面將變得無法控制,所以一般我們是不希望它生成多余的代碼的,具體的設置方法如果,在struts.xml中統一配置
    <constant name="struts.ui.theme" value="simple"/>加上該句即可
    也可以通過在頁面中將tag的theme屬性設為"simple"取消其默認的表格布局
    不過最好是:自定義一個theme,并將其設為默認應用到整個站點,如此一來就可以得到統一的站點風格

    7:jsp頁面中格式化日期的方法

    <s:date name="unCarInsModificationInfo.createTime" format="yyyy-MM-dd" nice="false"/>這樣就可以將日期格式化為yyyy-MM-dd的形式

    8:默認情況下,當請求action發生時,Struts運行時(Runtime)根據struts.xml里的Action映射集(Mapping),實例化action對應的類,并調用其execute方法。當然,我們可以通過以下兩種方法改變這種默認調用

    1)在classes/sturts.xml中新建Action,并指明其調用的方法
    比如想調用action類中的

    public String aliasAction() {
    message ="自定義Action調用方法";
    return SUCCESS;
    }
    則在classes/sturts.xml中加入下面代碼:
    <action name="AliasHelloWorld" class="tutorial.HelloWorld" method="aliasAction">
    <result>/HelloWorld.jsp</result>
    </action>
    既可用action名調用該方法了

    2)(比較常用)

    訪問Action時,在Action名后加上“!xxx”(xxx為方法名)。

    9:Struts 2.0有兩個配置文件,struts.xml和struts.properties都是放在WEB-INF/classes/下。
    struts.xml用于應用程序相關的配置
    struts.properties用于Struts 2.0的運行時(Runtime)的配置

    10:在action類中取得web下某一文件夾物理路徑(絕對路徑)的方法
    filePath = ServletActionContext.getServletContext().getRealPath("/upLoadFiles")

    11:要想返回的頁面不是一個直接JSP頁面而是要先通過返回action中的方法讀取相應的數據再返回到jsp頁面,有兩種方法

    1)在struts.xml中這么設置

    <result name="list" type="redirect-action">sysmanage/UserBaseInfoAction!findUserBaseInfo.action</result>

    2)在action中返回時直接調用這個方法即可

    return findList();

    12:設置checkboxlist中默認值的方法

    <s:checkboxlist name="skills1"
    ="Skills 1"
    list="{ 'Java', '.Net', 'RoR', 'PHP' }"
    value="{ 'Java', '.Net' }" />
    <s:checkboxlist name="skills2"
    label="Skills 2"
    list="#{ 1:'Java', 2: '.Net', 3: 'RoR', 4: 'PHP' }"
    listKey="key"
    listValue="value"
    value="{ 1, 2, 3 }"/>

    13:二級級連下拉框

    <s:set name="foobar"
    value="#{'Java': {'Spring', 'Hibernate', 'Struts 2'}, '.Net': {'Linq', ' ASP.NET 2.0'}, 'Database': {'Oracle', 'SQL Server', 'DB2', 'MySQL'}}" />
    <s:doubleselect list="#foobar.keySet()"
    doubleName="technology"
    doubleList="#foobar[top]"
    label="Technology" />

    posted on 2008-10-12 12:59 HUIKK 閱讀(2291) 評論(0)  編輯  收藏 所屬分類: Struts
    主站蜘蛛池模板: 亚洲精品国产成人中文| 亚洲av中文无码字幕色不卡| 久久精品国产免费观看三人同眠| 亚洲Av无码一区二区二三区| 成年女人免费视频播放体验区| 亚洲精品无码mv在线观看网站| 日韩精品亚洲专区在线观看| 国产亚洲一区二区手机在线观看| 亚洲国产精品无码专区| 亚洲A∨精品一区二区三区| 成年人性生活免费视频| 在线观看视频免费完整版| 成人最新午夜免费视频| 久久综合亚洲色HEZYO国产| 亚洲日韩国产精品第一页一区| 亚洲国产成人久久综合区| 手机在线免费视频| 亚洲国产精品免费观看| 18成禁人视频免费网站| 亚洲国产成人久久精品动漫 | 黑人精品videos亚洲人| 久久精品国产亚洲AV天海翼| 国产一精品一AV一免费| 99久久99久久免费精品小说| 国产精品亚洲综合天堂夜夜| 久久精品国产亚洲| 四虎亚洲国产成人久久精品 | 最好免费观看韩国+日本 | 午夜精品免费在线观看| 黄页网址大全免费观看12网站| 亚洲高清无在码在线电影不卡| 免费看的成人yellow视频| 日本在线免费播放| 相泽南亚洲一区二区在线播放| 亚洲国产二区三区久久| 亚洲熟妇少妇任你躁在线观看无码| 成人免费视频观看无遮挡| 久久精品无码专区免费青青| 东北美女野外bbwbbw免费 | 一级成人a免费视频| 丰满亚洲大尺度无码无码专线|