<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人影院| 亚洲va无码手机在线电影| 亚洲av无码电影网| 18级成人毛片免费观看| 亚洲第一页中文字幕| 18禁免费无码无遮挡不卡网站| 亚洲制服丝袜精品久久| 中文字幕无码播放免费| 亚洲色丰满少妇高潮18p| 国产伦一区二区三区免费| 人妻18毛片a级毛片免费看| 国产AV无码专区亚洲AV手机麻豆| 国产免费一区二区三区在线观看| 久久精品视频亚洲| 亚洲一区二区三区免费观看| 亚洲日本香蕉视频观看视频| 99在线视频免费观看视频| 亚洲精品日韩一区二区小说| 四虎影库久免费视频| 美女被免费网站91色| 18亚洲男同志videos网站| 久久久久久久91精品免费观看| 亚洲精品久久无码| 中文字幕亚洲综合久久男男| 最近国语视频在线观看免费播放| 久久亚洲私人国产精品| 日本免费福利视频| a级毛片100部免费观看| 亚洲中文无码线在线观看| 暖暖免费高清日本一区二区三区| 夜夜爽妓女8888视频免费观看| 久久精品国产精品亚洲精品 | 亚洲女同成av人片在线观看| 中文字幕免费观看全部电影| 91亚洲国产成人精品下载| 免费观看的毛片大全| 一级美国片免费看| 亚洲无线一二三四区| 亚洲日韩在线观看| 全免费毛片在线播放| 中文永久免费观看网站|