freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

freemarker在struts中的應(yīng)用-資料下載頁

2025-08-16 23:21本頁面
  

【正文】 e implements TemplateMethodModel { public TemplateModel exec(List args) throws TemplateModelException {SimpleDateFormat mydate = new SimpleDateFormat((String) (0)))。 return (new Date(((String)(1)))。 }} 將LongToDate對(duì)象放入到數(shù)據(jù)模型中(timer, new IndexOfMethod())。ftl模板里使用assign x = 123112455445${timer(yyyyMMdd H:mm:ss, x)}${timer(yyyyMMdd , x)}輸出20011012 5:21:1220011012自定義 Transforms實(shí)現(xiàn)自定義的@transform文本或表達(dá)式/@transform的功能,允許對(duì)中間的最終文本進(jìn)行解析轉(zhuǎn)換例子:實(shí)現(xiàn)@upcasestr/@upcase 將str轉(zhuǎn)換成STR 的功能代碼如下:import .*。import .*。import 。class UpperCaseTransform implements TemplateTransformModel { public Writer getWriter(Writer out, Map args) { return new UpperCaseWriter(out)。 } private class UpperCaseWriter extends Writer { private Writer out。 UpperCaseWriter (Writer out) { = out。 } public void write(char[] cbuf, int off, int len) throws IOException { (new String(cbuf, off, len).toUpperCase())。 } public void flush() throws IOException { ()。 } public void close() { } }} 然后將此對(duì)象put到數(shù)據(jù)模型中(upcase, new UpperCaseTransform())。在view(ftl)頁面中可以如下方式使用@upcasehello world/@upcase打印輸出:HELLO WORLDF.Builtins${x?upper_case}– 小寫變大寫${test?html} 轉(zhuǎn)換為HTML編碼格式${repeat(A, B)} – 復(fù)制B次AExample:${test?html}${test?upper_case?html}Assuming that test stores the string ``Tom amp。 Jerry39。39。, the output will be:Tom amp。amp。 JerryTOM amp。amp。 JERRY${repeat(What, 3)}will print: :WhatWhatWhat1. String內(nèi)置的JavaScript轉(zhuǎn)換: js_string 用途:用于JavaScript轉(zhuǎn)義,轉(zhuǎn)換39。,換行等特殊字符 模板:script alert(${errorMessage?js_string})。 /script輸出:script alert(Readonly\39。s pet name is \Cross Bone\)。 /script:default 用途: 用于處理默認(rèn)值 模本:User: ${?default(Anonymous)}td${()?default(amp。nbsp。)}/td輸出:User: Anonymous tdamp。nbsp。/td 注,可以對(duì)整個(gè)對(duì)象樹加上(),再用內(nèi)置處理器這種方便的做法,偶也是最近剛學(xué)會(huì)的,以前一直用很傻的方法做.....3. Sequence內(nèi)置的計(jì)數(shù)器: xxx_index 用途:顯示序號(hào) 模板:list employees as e ${e_index}. ${} /list輸出:1. Readonly 2. Robbin4. Sequence內(nèi)置的分段器: chunk 用途:某些比較BT的排版需求 模板:assign seq = [39。a39。, 39。b39。, 39。c39。, 39。d39。, 39。e39。, 39。f39。, 39。g39。, 39。h39。, 39。i39。, 39。j39。] list seq?chunk(4) as row ul lilist row as cell${cell} /list/li /ul /listlist seq?chunk(4, 39。39。) as row tr tdlist row as cell${cell} /list/td /tr /list 輸出:ul lia/li lib/li lic/li lid/li /ul ul lie/li lif/li lig/li lih/li /ul ul lii/li lij/li /ultr tda/td tdb/td tdc/td tdd/td /tr tr tde/td tdf/td tdg/td tdh/td /tr tr tdi/td tdj/td td/td td/td /trString ${It39。s \quoted\ and this is a backslash: \\} ${39。It\39。s quoted and this is a backslash: \\39。} ${r${foo}} raw字符串,原封不動(dòng)地現(xiàn)實(shí)引號(hào)中的內(nèi)容 ps:前一種是用雙引號(hào)來引用字符串,后一種是用單引號(hào)來引用字符串。 分別需要對(duì)雙引號(hào)和單引號(hào)進(jìn)行轉(zhuǎn)義 ${${user}${user}${user}${user}} ${user + user + user + user} 效果相同 ★substring ${user[0]}${user[4]} ${user[1..4]} ${user[4..]} ★number 不支持科學(xué)計(jì)數(shù)法 小數(shù)點(diǎn)前面的零不能省略 ★sequences list [winter, spring, summer, autumn] as x ${x} /list list 2..5 as x ${x} /list list [2,3,4,5] as x ${x} /list 數(shù)組的拼接 list [Joe, Fred] + [Julia, Kate] as user ${user} /list ★hash assign ages = {Joe:23, Fred:25} + {Joe:30, Julia:18} Joe is ${} Fred is ${} Julia is ${} 注意重復(fù)的鍵對(duì)應(yīng)的值取最后的一個(gè) ★運(yùn)算 ${5/2?int} 顯示2 cap_first : 首字母大寫capitalize: 所有單詞首刺目大寫html : 轉(zhuǎn)換為HTML格式 replaced with amp。lt。 replaced with amp。gt。 amp。 replaced with amp。amp。 replaced with amp。quot。 index_of : 顯示元素所在的位置abcabc?index_of(bc)返回值為1(下標(biāo)從0開始)Contains:判斷是否存在字符if piceous?contains(ice)It contains ice/if輸出: It contains iceReplace :替換split(“XX”):截取XX之后的字符list someMOOtestMOOtext?split(MOO) as x ${x}/list輸出: some test textstarts_with :字符串由什么開始 返回布爾型trim :去掉空格seq_index_of 數(shù)組中元素的位置 assign colors = [red, green, blue]${colors?seq_index_of(blue)}輸出: 2Default : 設(shè)置變量的默認(rèn)值Exists:放在if句 如果沒有…..if mouse?exists Mouse foundelse No mouse found/ifCreating mouse...assign mouse = Jerryif mouse?exists Mouse foundelse No mouse found/if 輸出 : No mouse foundCreating mouse... Mouse foundif_exists 放在一般語句(${mouse?if_exists})Creating mouse...assign mouse = Jerry(${mouse?if_exists})輸出:()Creating mouse...(Jerry)刪除空白行和空格press .../press讓此標(biāo)記內(nèi)的代碼都執(zhí)行escape 后的?參數(shù)escape/escapeescape x as x?html From: ${} Subject: ${} noescapeMessage: ${}/noescape .../escape輸出:From: ${?html} Subject: ${?html} Message: ${} ...
點(diǎn)擊復(fù)制文檔內(nèi)容
職業(yè)教育相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1