麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發 > Java > 正文

struts2中simple主題下 標簽默認樣式的移除方法

2024-07-14 08:42:31
字體:
來源:轉載
供稿:網友

前言

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

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

方法如下

①找到配置文件

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

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

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

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

③修改拷貝過來的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

總結

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


注:相關教程知識閱讀請移步到JAVA教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产福利不卡一区二区三区 | 最新欧美精品一区二区三区 | 中文字幕 亚洲一区 | 亚洲少妇诱惑 | 久久久三区 | 国产高潮好爽受不了了夜色 | 日韩毛片网站 | 免费香蕉成视频成人网 | 久在线观看福利视频69 | 国产三级国产精品国产普男人 | 久久久久久久亚洲精品 | 国产一级毛片高清 | 在线免费观看毛片视频 | 一级做受大片免费视频 | 九九色网站| 久久免费视频一区二区三区 | 大学生一级毛片在线视频 | 国产精品www| 亚洲一区在线视频观看 | www国产成人免费观看视频,深夜成人网 | 久久免费视频一区 | 日韩av有码在线 | 9797色| 一本一道久久久a久久久精品91 | 欧美三级日本三级少妇99 | 成人午夜在线免费观看 | 一道本不卡一区 | av电影手机在线看 | 欧美成视频在线观看 | 欧美黄色大片免费观看 | 特级黄色影院 | 国产精品成人免费一区久久羞羞 | 免费一级电影 | 国产成人精品区 | 俄罗斯hdxxx 日夜操天天干 | 成人在线影视 | 视频一区二区国产 | 久久国产乱子伦精品 | 91精品动漫在线观看 | 欧美亚洲啪啪 | 久色成人 |