如何删除strut2校验后<s:fielderror>在jsp页面输出时的小黑点和自动换行?

删除前:





删除后:




删除方法:

首先找到filederror.ftl文件,来源:从项目lib中找到struts2-core-2.2.1.jar,拷贝到桌面解压,在temple/simple就可以找到fielderror.ftl,然后删除里面的<ul>和<li>

只删标签,不删内容,删除完是这个样子:

  1. <#--  
  2. /*  
  3.  * $Id: Action.java 502296 2007-02-01 17:33:39Z niallp $  
  4.  *  
  5.  * Licensed to the Apache Software Foundation (ASF) under one  
  6.  * or more contributor license agreements.  See the NOTICE file  
  7.  * distributed with this work for additional information  
  8.  * regarding copyright ownership.  The ASF licenses this file  
  9.  * to you under the Apache License, Version 2.0 (the  
  10.  * "License"); you may not use this file except in compliance  
  11.  * with the License.  You may obtain a copy of the License at  
  12.  *  
  13.  *  http://www.apache.org/licenses/LICENSE-2.0  
  14.  *  
  15.  * Unless required by applicable law or agreed to in writing,  
  16.  * software distributed under the License is distributed on an  
  17.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  
  18.  * KIND, either express or implied.  See the License for the  
  19.  * specific language governing permissions and limitations  
  20.  * under the License.  
  21.  */  
  22. -->  
  23. <#if fieldErrors?exists><#t/>  
  24. <#assign eKeys = fieldErrors.keySet()><#t/>  
  25. <#assign eKeysSize = eKeys.size()><#t/>  
  26. <#assign doneStartUlTag=false><#t/>  
  27. <#assign doneEndUlTag=false><#t/>  
  28. <#assign haveMatchedErrorField=false><#t/>  
  29. <#if (fieldErrorFieldNames?size > 0) ><#t/>  
  30.     <#list fieldErrorFieldNames as fieldErrorFieldName><#t/>  
  31.         <#list eKeys as eKey><#t/>  
  32.         <#if (eKey = fieldErrorFieldName)><#t/>  
  33.             <#assign haveMatchedErrorField=true><#t/>  
  34.             <#assign eValue = fieldErrors[fieldErrorFieldName]><#t/>  
  35.             <#if (haveMatchedErrorField && (!doneStartUlTag))><#t/>  
  36.                   
  37.                 <#assign doneStartUlTag=true><#t/>  
  38.             </#if><#t/>  
  39.             <#list eValue as eEachValue><#t/>  
  40.                 <span<#rt/>  
  41. <#if parameters.cssClass?exists>  
  42.  class="${parameters.cssClass?html}"<#rt/>  
  43. <#else>  
  44.  class="errorMessage"<#rt/>  
  45. </#if>  
  46. <#if parameters.cssStyle?exists>  
  47.  style="${parameters.cssStyle?html}"<#rt/>  
  48. </#if>  
  49. >${eEachValue}</span>  
  50.             </#list><#t/>             
  51.         </#if><#t/>  
  52.         </#list><#t/>  
  53.     </#list><#t/>  
  54.     <#if (haveMatchedErrorField && (!doneEndUlTag))><#t/>  
  55.           
  56.         <#assign doneEndUlTag=true><#t/>  
  57.     </#if><#t/>  
  58. <#else><#t/>  
  59.     <#if (eKeysSize > 0)><#t/>  
  60.           
  61.             <#list eKeys as eKey><#t/>  
  62.                 <#assign eValue = fieldErrors[eKey]><#t/>  
  63.                 <#list eValue as eEachValue><#t/>  
  64.                     <span<#rt/>  
  65. <#if parameters.cssClass?exists>  
  66.  class="${parameters.cssClass?html}"<#rt/>  
  67. <#else>  
  68.  class="errorMessage"<#rt/>  
  69. </#if>  
  70. <#if parameters.cssStyle?exists>  
  71.  style="${parameters.cssStyle?html}"<#rt/>  
  72. </#if>  
  73. >${eEachValue}</span>  
  74.                 </#list><#t/>  
  75.             </#list><#t/>  
  76.           
  77.     </#if><#t/>  
  78. </#if><#t/>  
  79. </#if><#t/>  




在项目中新建一个包template.simple,然后把fielderror.ftl 文件拷贝到包中即可





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值