一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - Java教程 - struts2中simple主題下<s:fieldError>標簽默認樣式的移除方法

struts2中simple主題下<s:fieldError>標簽默認樣式的移除方法

2021-06-03 11:45努力學習的IT萌新 Java教程

這篇文章主要給大家介紹了關于struts2中simple主題下<s:fieldError>標簽默認樣式的移除方法,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考借鑒,下面隨著小編來一起學習學習吧

前言

當在我們注冊用戶時,如果給前臺的提示是用戶名重復并且用戶名太長時,就會要往action里面添加多個errors,這時到前臺怎么把它依次拿出來

下面話不多說了,來一起看看詳細的介紹吧

方法如下

①找到配置文件

struts2-core-2.3.35.jar/template/simple/fielderror.ftl(不同版本的文件路徑大同小異)

②創建新的文件包并拷貝文件

在項目根目錄下創建template.simple并將fielderror.ftl拷貝過來

此時根目錄下的fielderror.ftl文件優先權大于默認的fielderror.ftl文件

③修改拷貝過來的fielderror.ftl文件

修改前文件如下

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<#--
/*
 * $id$
 *
 * licensed to the apache software foundation (asf) under one
 * or more contributor license agreements. see the notice file
 * distributed with this work for additional information
 * regarding copyright ownership. the asf licenses this file
 * to you under the apache license, version 2.0 (the
 * "license"); you may not use this file except in compliance
 * with the license. you may obtain a copy of the license at
 *
 * http://www.apache.org/licenses/license-2.0
 *
 * unless required by applicable law or agreed to in writing,
 * software distributed under the license is distributed on an
 * "as is" basis, without warranties or conditions of any
 * kind, either express or implied. see the license for the
 * specific language governing permissions and limitations
 * under the license.
 */
-->
<#if fielderrors??><#t/>
 <#assign ekeys = fielderrors.keyset()><#t/>
 <#assign ekeyssize = ekeys.size()><#t/>
 <#assign donestartultag=false><#t/>
 <#assign doneendultag=false><#t/>
 <#assign havematchederrorfield=false><#t/>
 <#if (fielderrorfieldnames?size > 0) ><#t/>
  <#list fielderrorfieldnames as fielderrorfieldname><#t/>
   <#list ekeys as ekey><#t/>
    <#if (ekey = fielderrorfieldname)><#t/>
     <#assign havematchederrorfield=true><#t/>
     <#assign evalue = fielderrors[fielderrorfieldname]><#t/>
     <#if (havematchederrorfield && (!donestartultag))><#t/>
     <ul<#rt/>
      <#if parameters.id?has_content>
        id="${parameters.id?html}"<#rt/>
      </#if>
      <#if parameters.cssclass?has_content>
        class="${parameters.cssclass?html}"<#rt/>
       <#else>
        class="errormessage"<#rt/>
      </#if>
      <#if parameters.cssstyle?has_content>
        style="${parameters.cssstyle?html}"<#rt/>
      </#if>
       >
      <#assign donestartultag=true><#t/>
     </#if><#t/>
     <#list evalue as eeachvalue><#t/>
      <li><span><#if parameters.escape>${eeachvalue!?html}<#else>${eeachvalue!}</#if></span></li>
     </#list><#t/>
    </#if><#t/>
   </#list><#t/>
  </#list><#t/>
  <#if (havematchederrorfield && (!doneendultag))><#t/>
  </ul>
   <#assign doneendultag=true><#t/>
  </#if><#t/>
  <#else><#t/>
  <#if (ekeyssize > 0)><#t/>
  <ul<#rt/>
   <#if parameters.cssclass?has_content>
     class="${parameters.cssclass?html}"<#rt/>
    <#else>
     class="errormessage"<#rt/>
   </#if>
   <#if parameters.cssstyle?has_content>
     style="${parameters.cssstyle?html}"<#rt/>
   </#if>
    >
   <#list ekeys as ekey><#t/>
    <#assign evalue = fielderrors[ekey]><#t/>
    <#list evalue as eeachvalue><#t/>
     <li><span><#if parameters.escape>${eeachvalue!?html}<#else>${eeachvalue!}</#if></span></li>
    </#list><#t/>
   </#list><#t/>
  </ul>
  </#if><#t/>
 </#if><#t/>
</#if><#t/>

將<ul></ul>、<li></li>、<span></span>刪除

修改后文件如下

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<#--
/*
 * $id$
 *
 * licensed to the apache software foundation (asf) under one
 * or more contributor license agreements. see the notice file
 * distributed with this work for additional information
 * regarding copyright ownership. the asf licenses this file
 * to you under the apache license, version 2.0 (the
 * "license"); you may not use this file except in compliance
 * with the license. you may obtain a copy of the license at
 *
 * http://www.apache.org/licenses/license-2.0
 *
 * unless required by applicable law or agreed to in writing,
 * software distributed under the license is distributed on an
 * "as is" basis, without warranties or conditions of any
 * kind, either express or implied. see the license for the
 * specific language governing permissions and limitations
 * under the license.
 */
-->
<#if fielderrors??><#t/>
 <#assign ekeys = fielderrors.keyset()><#t/>
 <#assign ekeyssize = ekeys.size()><#t/>
 <#assign donestartultag=false><#t/>
 <#assign doneendultag=false><#t/>
 <#assign havematchederrorfield=false><#t/>
 <#if (fielderrorfieldnames?size > 0) ><#t/>
  <#list fielderrorfieldnames as fielderrorfieldname><#t/>
   <#list ekeys as ekey><#t/>
    <#if (ekey = fielderrorfieldname)><#t/>
     <#assign havematchederrorfield=true><#t/>
     <#assign evalue = fielderrors[fielderrorfieldname]><#t/>
     <#if (havematchederrorfield && (!donestartultag))><#t/>
     
      <#assign donestartultag=true><#t/>
     </#if><#t/>
     <#list evalue as eeachvalue><#t/>
      <#if parameters.escape>${eeachvalue!?html}<#else>${eeachvalue!}</#if>
     </#list><#t/>
    </#if><#t/>
   </#list><#t/>
  </#list><#t/>
  <#if (havematchederrorfield && (!doneendultag))><#t/>
  
   <#assign doneendultag=true><#t/>
  </#if><#t/>
  <#else><#t/>
  <#if (ekeyssize > 0)><#t/>
  
   <#list ekeys as ekey><#t/>
    <#assign evalue = fielderrors[ekey]><#t/>
    <#list evalue as eeachvalue><#t/>
     <#if parameters.escape>${eeachvalue!?html}<#else>${eeachvalue!}</#if>
    </#list><#t/>
   </#list><#t/>
  
  </#if><#t/>
 </#if><#t/>
</#if><#t/>

重啟tomcat

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對服務器之家的支持。

原文鏈接:http://www.cnblogs.com/zhanghongcan/p/9753917.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 亚偷熟乱区视频在线观看 | 草草视频在线观看最新 | 国产成人夜色影视视频 | 偷拍综合网| 深夜影院深a久久 | 国产传媒在线播放 | 91精品国产综合久久福利 | 午夜久久久久久亚洲国产精品 | 青青视频国产依人在线 | 92国产福利久久青青草原 | 羞羞漫画免费漫画页面在线看漫画秋蝉 | 精品无码国产AV一区二区三区 | 日韩精品欧美国产精品亚 | 欧美 亚洲 综合 卡通 另类 区 | 日你逼| 美女张开腿让男人桶的 视频 | 亚洲精品国产精品国自产观看 | 国产高清露脸学生在线观看 | 娇喘高潮教室h | 久青草国产在视频在线观看 | 天堂资源在线www中文 | 黄瓜视频免费 | 精品国产日韩亚洲一区在线 | 好紧好爽再叫浪一点点潘金莲 | 99re这里都是精品 | 国产成人手机在线好好热 | 91网红福利精品区一区二 | 久久热在线视频精品店 | 国产精品视频一区二区三区经 | porno中国xxxxx| 午夜福利自怕 | 四虎网站在线 | 9999网站| 亚洲国产精品综合久久一线 | 日本视频中文字幕 | 四虎影视4hu最新地址在线884 | ass亚洲熟妇毛茸茸pics | 成人小视频在线观看免费 | а天堂中文最新版在线官网视频 | 强漂亮白丝女教师小说 | 美女脱了内裤让男生玩屁股 |