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

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

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

    Java Home

    Java技術(shù)修煉中...
    posts - 20, comments - 22, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    2007年5月20日

    FreeMarker是一個模板引擎,一個基于模板生成文本輸出的通用工具,使用純Java編寫

    FreeMarker被設(shè)計(jì)用來生成HTML Web頁面,特別是基于MVC模式的應(yīng)用程序

    雖然FreeMarker具有一些編程的能力,但通常由Java程序準(zhǔn)備要顯示的數(shù)據(jù),由FreeMarker生成頁面,通過模板顯示準(zhǔn)備的數(shù)據(jù)

    FreeMarker不是一個Web應(yīng)用框架,而適合作為Web應(yīng)用框架一個組件

    FreeMarker與容器無關(guān),因?yàn)樗⒉恢繦TTP或Servlet;FreeMarker同樣可以應(yīng)用于非Web應(yīng)用程序環(huán)境

    FreeMarker更適合作為Model2框架(如Struts)的視圖組件,你也可以在模板中使用JSP標(biāo)記庫

    FreeMarker是免費(fèi)的

    1、通用目標(biāo)

    能夠生成各種文本:HTML、XML、RTF、Java源代碼等等

    易于嵌入到你的產(chǎn)品中:輕量級;不需要Servlet環(huán)境

    插件式模板載入器:可以從任何源載入模板,如本地文件、數(shù)據(jù)庫等等

    你可以按你所需生成文本:保存到本地文件;作為Email發(fā)送;從Web應(yīng)用程序發(fā)送它返回給Web瀏覽器

    2、強(qiáng)大的模板語言

    所有常用的指令:include、if/elseif/else、循環(huán)結(jié)構(gòu)

    在模板中創(chuàng)建和改變變量

    幾乎在任何地方都可以使用復(fù)雜表達(dá)式來指定值

    命名的宏,可以具有位置參數(shù)和嵌套內(nèi)容

    名字空間有助于建立和維護(hù)可重用的宏庫,或者將一個大工程分成模塊,而不必?fù)?dān)心名字沖突

    輸出轉(zhuǎn)換塊:在嵌套模板片段生成輸出時,轉(zhuǎn)換HTML轉(zhuǎn)義、壓縮、語法高亮等等;你可以定義自己的轉(zhuǎn)換

    3、通用數(shù)據(jù)模型

    FreeMarker不是直接反射到Java對象,Java對象通過插件式對象封裝,以變量方式在模板中顯示

    你可以使用抽象(接口)方式表示對象(JavaBean、XML文檔、SQL查詢結(jié)果集等等),告訴模板開發(fā)者使用方法,使其不受技術(shù)細(xì)節(jié)的打擾

    4、為Web準(zhǔn)備

    在模板語言中內(nèi)建處理典型Web相關(guān)任務(wù)(如HTML轉(zhuǎn)義)的結(jié)構(gòu)

    能夠集成到Model2 Web應(yīng)用框架中作為JSP的替代

    支持JSP標(biāo)記庫

    為MVC模式設(shè)計(jì):分離可視化設(shè)計(jì)和應(yīng)用程序邏輯;分離頁面設(shè)計(jì)員和程序員

    5、智能的國際化和本地化

    字符集智能化(內(nèi)部使用UNICODE)

    數(shù)字格式本地化敏感

    日期和時間格式本地化敏感

    非US字符集可以用作標(biāo)識(如變量名)

    多種不同語言的相同模板

    6、強(qiáng)大的XML處理能力

    <#recurse> 和<#visit>指令(2.3版本)用于遞歸遍歷XML樹

    在模板中清楚和直覺的訪問XML對象模型

    posted @ 2007-06-19 08:26 Yemoo'S Java Blog 閱讀(497) | 評論 (0)編輯 收藏

    當(dāng)jsp程序出現(xiàn)異常時,往往是直接輸出到瀏覽器頁面上的,這樣以來,可能使最終用戶感到不知所措,也可能因?yàn)楸┞斗?wù)器某些信息而導(dǎo)致服務(wù)器的安全性問題。在jsp里我們可以通過制定errorPage="xxx"以使當(dāng)程序出現(xiàn)錯誤時轉(zhuǎn)向指定的錯誤頁面,但如果前期沒有考慮到這個辦法而在系統(tǒng)完成后再去這些工作則工作量可能會很大,好在jsp規(guī)范提供了一種簡單的解決辦法,通過在web.xml中設(shè)定全局錯誤處理頁面來對整個項(xiàng)目有效,web.xml中對于不同的http返回結(jié)果或異常類型可以有不同的處理方式。
    在xml中配置如下:
    <error-page>
    ???<error-code>500</error-code>
    ???<location>error.jsp</location>
    </error-page>
    <error-page>
    ???<error-code>404</error-code>
    ???<location>notfound.jsp</location>
    </error-page>

    通過以上配置,程序會自動根據(jù)錯誤類型轉(zhuǎn)向不同的錯誤頁面。

    posted @ 2007-06-06 15:59 Yemoo'S Java Blog 閱讀(1759) | 評論 (0)編輯 收藏

    前段時間作了一個簡單的系統(tǒng),其中涉及到后臺管理,當(dāng)然也就遇到了權(quán)限驗(yàn)證的問題,由于初次做J2EE項(xiàng)目,所有這些東西懂我來說都是個開始。
    對于權(quán)限驗(yàn)證,如果程序由目錄劃分,如管理員訪問的頁面都放在admin下,這樣我們可以寫一個權(quán)限驗(yàn)證的過濾器,然后配置admin目錄都要經(jīng)過這個過濾器即可。這樣對于jsp頁面的權(quán)限驗(yàn)證比較容易。但對于action(控制器類)就不好控制了,因?yàn)閍ction是沒有目錄概念的,如我們訪問action的地址為:http://xxx/sample/ac1.action,同時如果使用http://xxx/sample/xx/xx/ac1.action同樣可以訪問,這是因?yàn)橹灰谶@個項(xiàng)目目錄下,訪問的頁面如果為action則struts就會去查詢這個action名字對應(yīng)的類,而不管前面的目錄結(jié)構(gòu)。因此我們不能再用過濾器對管理員部分的action進(jìn)行驗(yàn)證。經(jīng)過查看struts2的相關(guān)資料發(fā)現(xiàn)了攔截器這個有用的東西。通過struts2的配置文件的包管理功能和攔截器可以輕松的對指定的action做管理(攔截),如
    ===================================================
    <package name="user" extends="struts-default">
    ??<!-- 前臺用戶操作部分 -->
    ??<!-- 框架頁,顯示分類 -->
    ??<action name="queryCateForwardUI"
    ???class="com.topsoft.bookmanage.web.action.QueryCateForwardActionUI">
    ???<result>/mainPage.jsp</result>
    ??</action>
    ??? 。。。。。
    </package>
    <!-- 管理員操作部分 -->
    ?<package name="manager" extends="struts-default">
    ??<!-- 攔截器 -->
    ??<interceptors>
    ???<interceptor name="auth" class="com.topsoft.common.LogonInterceptor" />
    ???<interceptor-stack name="authStack">?
    ??????????????? <interceptor-ref name="auth"/>?
    ??????????????? <interceptor-ref name="paramsPrepareParamsStack"/>?
    ??????????? </interceptor-stack>?
    ??</interceptors>
    ??<!-- 默認(rèn)執(zhí)行的攔截器 -->
    ??<default-interceptor-ref name="authStack"/>
    ??<!-- 全局Action映射 -->
    ??<global-results>
    ???<result name="login" type="redirect">/managerLoginUI.action</result>
    ??</global-results>
    ??
    ??<!-- 后臺管理首頁面UI -->
    ??<action name="managerIndexUI"
    ???class="com.topsoft.bookmanage.web.action.ManagerIndexActionUI">
    ???<result>/admin/index.jsp</result>
    ??</action>
    ?。。。。。。
    </package>
    =================================================

    通過使用攔截器+過濾器可以完美解決權(quán)限驗(yàn)證的問題。

    posted @ 2007-06-06 15:17 Yemoo'S Java Blog 閱讀(4978) | 評論 (6)編輯 收藏

    struts.action.extension
    ????????? The URL extension to use to determine if the request is meant for a Struts action
    ?????????? 用URL擴(kuò)展名來確定是否這個請求是被用作Struts action,其實(shí)也就是設(shè)置 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的完整連續(xù)的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開發(fā)模式

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

    struts.enable.DynamicMethodInvocation
    ????????? Allows one to disable dynamic method invocation from the URL
    ??????????? 允許動態(tài)方法調(diào)用

    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
    ?????????? 國際化信息內(nèi)碼

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

    struts.locale
    ????????? The default locale for the Struts application
    ?????????? 默認(rèn)的國際化地區(qū)信息

    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
    ?????????? 設(shè)置存儲上傳文件的目錄夾

    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應(yīng)該使用自身的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過濾器中提供的靜態(tài)內(nèi)容應(yīng)該被瀏覽器緩存在頭部屬性中

    struts.serve.static
    ????????? Whether the Struts filter should serve static content or not
    ?????????? 是否struts過濾器應(yīng)該提供靜態(tài)內(nèi)容

    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
    ?????????? 默認(rèn)的UI template主題

    struts.url.http.port
    ????????? The HTTP port used by Struts URLs
    ?????????? 設(shè)置http端口

    struts.url.https.port
    ????????? The HTTPS port used by Struts URLs
    ?????????? 設(shè)置https端口

    struts.url.includeParams
    ????????? The default includeParams method to generate Struts URLs
    ????????? 在url中產(chǎn)生 默認(rèn)的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模版應(yīng)該被緩存

    posted @ 2007-05-20 19:05 Yemoo'S Java Blog 閱讀(543) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 18亚洲男同志videos网站| 亚洲精品少妇30p| 456亚洲人成在线播放网站| 91精品国产免费入口| 久久亚洲精品中文字幕三区| 成在人线av无码免费高潮喷水| 国产亚洲人成A在线V网站| 伊人久久大香线蕉免费视频| 亚洲精品综合久久| 国产精品免费看久久久香蕉 | CAOPORN国产精品免费视频| 激情综合色五月丁香六月亚洲| 岛国精品一区免费视频在线观看| 国产成人A亚洲精V品无码 | 最近2019中文字幕免费大全5| 亚洲ⅴ国产v天堂a无码二区| 亚洲精品在线免费看| 亚洲日本国产乱码va在线观看| 99久久99这里只有免费费精品 | 13一14周岁毛片免费| 亚洲AV男人的天堂在线观看| 国产精品国产午夜免费福利看| 一区在线免费观看| 午夜亚洲国产理论秋霞| 2021国产精品成人免费视频| 亚洲精品无码人妻无码| 亚洲视频在线免费| 一级毛片成人免费看免费不卡| 亚洲中文字幕久久精品无码2021| 免费观看a级毛片| 男女一边摸一边做爽的免费视频| 久久亚洲国产成人精品性色| 免费看的成人yellow视频| 久久久WWW免费人成精品| 亚洲一本之道高清乱码| 亚洲国产精品不卡毛片a在线| 99热在线精品免费播放6| 亚洲av午夜国产精品无码中文字| 中文字幕第13亚洲另类| 黄页网站在线看免费| 一区二区免费电影|