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

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

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视频 | av中文字幕网免费观看 | 日本一卡二卡3卡四卡网站精品 | 欧洲肥女大肥臀tv | 亚洲成年人在线观看 | 亚洲天天综合网 | 女人全身裸露无遮挡免费观看 | 校园刺激全黄H全肉细节文 校草让我脱了内裤给全班看 | 国内精品视频一区二区三区 | 久久婷婷五月综合色丁香花 | 日本综合在线观看 | 美女的隐私无遮挡撒尿 | 26uuu老色哥| 我的奶头被客人吸的又肿又红 | 2018生活片性色生活片 | 国产精品久久久久aaaa | 国产一卡| 亚洲精品乱码久久久久久蜜桃欧美 | 好大好爽好舒服视频 | 国产片自拍| 国产精品第一区揄拍 | 小柔的性放荡羞辱日记 | 激情艳妇| 欧美性xxxxxx爱 | 无删减影视免费观看 | 99久久精品免费看国产 | 久久久精品免费免费直播 | japanese乱子mate | 亚洲一级片在线播放 | 亚洲视频高清 | 91久久偷偷做嫩草影院免费看 | 香蕉91 | 女仆色网址 | 人人人人人看碰人人免费 | 亚洲AV无码乱码在线观看浪潮 | 和老外3p爽粗大免费视频 | 美女认你摸 |