亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

struts2中simple主題下<s:fieldError>標(biāo)簽?zāi)J(rèn)樣式的移除方法

 更新時(shí)間:2018年10月11日 08:40:54   作者:努力學(xué)習(xí)的IT萌新  
這篇文章主要給大家介紹了關(guān)于struts2中simple主題下<s:fieldError>標(biāo)簽?zāi)J(rèn)樣式的移除方法,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

前言

當(dāng)在我們注冊(cè)用戶時(shí),如果給前臺(tái)的提示是用戶名重復(fù)并且用戶名太長(zhǎng)時(shí),就會(huì)要往action里面添加多個(gè)errors,這時(shí)到前臺(tái)怎么把它依次拿出來(lái)

下面話不多說(shuō)了,來(lái)一起看看詳細(xì)的介紹吧

方法如下

①找到配置文件

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

②創(chuàng)建新的文件包并拷貝文件

在項(xiàng)目根目錄下創(chuàng)建template.simple并將fielderror.ftl拷貝過(guò)來(lái)

此時(shí)根目錄下的fielderror.ftl文件優(yōu)先權(quán)大于默認(rèn)的fielderror.ftl文件

③修改拷貝過(guò)來(lái)的fielderror.ftl文件

修改前文件如下

<#--
/*
 * $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>刪除

修改后文件如下

<#--
/*
 * $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

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,如果有疑問(wèn)大家可以留言交流,謝謝大家對(duì)腳本之家的支持。

相關(guān)文章

  • java中的類為什么只能用public修飾?

    java中的類為什么只能用public修飾?

    這篇文章主要介紹了java中的類為什么只能用public修飾,幫助大家更好的理解和使用Java,感興趣的朋友可以了解下
    2020-12-12
  • Maven和IntelliJ IDEA搭建多模塊微服務(wù)的實(shí)現(xiàn)

    Maven和IntelliJ IDEA搭建多模塊微服務(wù)的實(shí)現(xiàn)

    本文主要介紹了Maven和IntelliJ IDEA搭建多模塊微服務(wù)的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2024-05-05
  • Java中常見(jiàn)的4種限流算法詳解

    Java中常見(jiàn)的4種限流算法詳解

    這篇文章主要介紹了Java中常見(jiàn)的4種限流算法詳解,FixedWindowRateLimiter 類表示一個(gè)固定窗口限流器,使用 limit 和 interval 參數(shù)分別表示限制請(qǐng)求數(shù)量和時(shí)間間隔,缺點(diǎn)是短時(shí)間內(nèi)可能會(huì)流量翻倍,需要的朋友可以參考下
    2023-12-12
  • javaweb 項(xiàng)目初始配置的方法步驟

    javaweb 項(xiàng)目初始配置的方法步驟

    本文主要介紹了javaweb 項(xiàng)目初始配置的方法步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-11-11
  • 基于java中正則操作的方法總結(jié)

    基于java中正則操作的方法總結(jié)

    本篇文章介紹了,在java中正則操作的方法總結(jié)。需要的朋友參考下
    2013-05-05
  • mybatis框架xml下trim中的prefix與suffix等標(biāo)簽的用法

    mybatis框架xml下trim中的prefix與suffix等標(biāo)簽的用法

    這篇文章主要介紹了mybatis框架xml下trim中的prefix與suffix等標(biāo)簽的用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-07-07
  • 一文搞懂如何實(shí)現(xiàn)Java,Spring動(dòng)態(tài)啟停定時(shí)任務(wù)

    一文搞懂如何實(shí)現(xiàn)Java,Spring動(dòng)態(tài)啟停定時(shí)任務(wù)

    定時(shí)任務(wù)的應(yīng)用場(chǎng)景十分廣泛,如定時(shí)清理文件、定時(shí)生成報(bào)表、定時(shí)數(shù)據(jù)同步備份等。本文將教你實(shí)現(xiàn)Java、Spring動(dòng)態(tài)啟停定時(shí)任務(wù),感興趣的可以學(xué)習(xí)一下
    2022-06-06
  • 基于CopyOnWriteArrayList并發(fā)容器(實(shí)例講解)

    基于CopyOnWriteArrayList并發(fā)容器(實(shí)例講解)

    下面小編就為大家?guī)?lái)一篇基于CopyOnWriteArrayList并發(fā)容器(實(shí)例講解)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-11-11
  • java虛擬機(jī)原理:類加載過(guò)程詳解

    java虛擬機(jī)原理:類加載過(guò)程詳解

    這篇文章主要介紹了Java中類加載過(guò)程全面解析,具有一定參考價(jià)值,需要的朋友可以了解下,希望能夠給你帶來(lái)幫助
    2021-09-09
  • springboot 監(jiān)控管理模塊搭建的方法

    springboot 監(jiān)控管理模塊搭建的方法

    本篇文章主要介紹了springboot 監(jiān)控管理模塊搭建的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-03-03

最新評(píng)論