svn commit: r1084628 - /struts/struts2/trunk/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/FieldErrorHandler.java
Author: mcucchiara Date: Wed Mar 23 16:24:09 2011 New Revision: 1084628 URL: http://svn.apache.org/viewvc?rev=1084628&view=rev Log: WW-3598 - FieldErrorHandler in javatemplates plugin does not respond to escape attribute (thanks Gareth Faires) Modified: struts/struts2/trunk/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/FieldErrorHandler.java Modified: struts/struts2/trunk/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/FieldErrorHandler.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/FieldErrorHandler.java?rev=1084628&r1=1084627&r2=1084628&view=diff == --- struts/struts2/trunk/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/FieldErrorHandler.java (original) +++ struts/struts2/trunk/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/FieldErrorHandler.java Wed Mar 23 16:24:09 2011 @@ -33,46 +33,49 @@ public class FieldErrorHandler extends A Map> errors = (Map>) findValue("fieldErrors"); List fieldErrorFieldNames = (List) params.get("errorFieldNames"); -if (fieldErrorFieldNames != null && !fieldErrorFieldNames.isEmpty()) { -//wrapping ul -Attributes attrs = new Attributes(); -attrs.addIfExists("style", params.get("cssStyle")) -.add("class", params.containsKey("cssClass") ? (String) params.get("cssClass") : "errorMessage"); -start("ul", attrs); +if (fieldErrorFieldNames != null && !fieldErrorFieldNames.isEmpty() && errors != null && !errors.isEmpty()) { +startUL(params); //iterate over field error names for (String fieldErrorFieldName : fieldErrorFieldNames) { List fieldErrors = errors.get(fieldErrorFieldName); if (fieldErrors != null) { for (String fieldError : fieldErrors) { -start("li", null); -start("span", null); -characters(fieldError); -end("span"); -end("li"); +writeError(params, fieldError); } } } -end("ul"); +endUL(); } else if (errors != null && !errors.isEmpty()) { -//wrapping ul -Attributes attrs = new Attributes(); -attrs.addIfExists("style", params.get("cssStyle")) -.add("class", params.containsKey("cssClass") ? (String) params.get("cssClass") : "errorMessage"); -start("ul", attrs); +startUL(params); for (Map.Entry> errorEntry : errors.entrySet()) { for (String fieldError : errorEntry.getValue()) { -start("li", null); -start("span", null); -characters(fieldError); -end("span"); -end("li"); +writeError(params, fieldError); } } -end("ul"); +endUL(); } } + +private void endUL() throws IOException { +end("ul"); +} + +private void writeError(Map params, String fieldError) throws IOException { +start("li", null); +start("span", null); +characters(fieldError, params.containsKey("escape") ? (Boolean) params.get("escape") : true); +end("span"); +end("li"); +} + +private void startUL(Map params) throws IOException { +Attributes attrs = new Attributes(); +attrs.addIfExists("style", params.get("cssStyle")) +.add("class", params.containsKey("cssClass") ? (String) params.get("cssClass") : "errorMessage"); +start("ul", attrs); +} }
[CONF] Confluence Changes in the last 24 hours
This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache ACE (https://cwiki.apache.org/confluence/display/ACE) Pages - Maven Build edited by marrs (02:45 AM) https://cwiki.apache.org/confluence/display/ACE/Maven+Build Running a management agent edited by marrs (02:41 AM) https://cwiki.apache.org/confluence/display/ACE/Running+a+management+agent Configuring the Management Agent edited by marrs (02:38 AM) https://cwiki.apache.org/confluence/display/ACE/Configuring+the+Management+Agent Getting Started with the Web UI Based Server edited by marrs (02:35 AM) https://cwiki.apache.org/confluence/display/ACE/Getting+Started+with+the+Web+UI+Based+Server Apache ActiveMQ (https://cwiki.apache.org/confluence/display/ACTIVEMQ) Pages - MDC Logging created by dejanb (08:33 AM) https://cwiki.apache.org/confluence/display/ACTIVEMQ/MDC+Logging Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL) Pages - FTP2 edited by rkettelerij (09:11 AM) https://cwiki.apache.org/confluence/display/CAMEL/FTP2 Apache Directory client API (https://cwiki.apache.org/confluence/display/DIRAPI) Pages - Dn edited by elecharny (01:59 PM) https://cwiki.apache.org/confluence/display/DIRAPI/Dn Apache MyFaces Extensions CDI (https://cwiki.apache.org/confluence/display/EXTCDI) Pages - Workarounds for Weld created by gpetracek (08:43 AM) https://cwiki.apache.org/confluence/display/EXTCDI/Workarounds+for+Weld Documentation edited by gpetracek (08:25 AM) https://cwiki.apache.org/confluence/display/EXTCDI/Documentation OFBiz (Open For Business) Project Open Wiki (https://cwiki.apache.org/confluence/display/OFBIZ) Pages - Apache OFBiz Service Providers edited by sykesdev (08:30 AM) https://cwiki.apache.org/confluence/display/OFBIZ/Apache+OFBiz+Service+Providers Apache Struts 2 Wiki (https://cwiki.apache.org/confluence/display/S2WIKI) Pages - AJAX Validation with JQuery instead of DWR or Prototype created by rogeriopaguilar (10:40 PM) https://cwiki.apache.org/confluence/display/S2WIKI/AJAX+Validation+with+JQuery+instead+of+DWR+or+Prototype Apache Sling Website (https://cwiki.apache.org/confluence/display/SLINGxSITE) Pages - Sling Testing Tools created by bdelacretaz (06:24 AM) https://cwiki.apache.org/confluence/display/SLINGxSITE/Sling+Testing+Tools Development edited by bdelacretaz (06:13 AM) https://cwiki.apache.org/confluence/display/SLINGxSITE/Development Apache ServiceMix 4.0 (https://cwiki.apache.org/confluence/display/SMX4) Pages - Creating an OSGi bundle for deploying JBI endpoints edited by gertvanthienen (07:52 AM) https://cwiki.apache.org/confluence/display/SMX4/Creating+an+OSGi+bundle+for+deploying+JBI+endpoints Apache Tapestry (https://cwiki.apache.org/confluence/display/TAPESTRY) Pages - Tapestry 5 in Action available through MEAP created by drobiazko (03:40 PM) https://cwiki.apache.org/confluence/display/TAPESTRY/2011/03/23/Tapestry+5+in+Action+available+through+MEAP Release Process edited by drobiazko (01:32 PM) https://cwiki.apache.org/confluence/display/TAPESTRY/Release+Process Apache Tuscany Wiki (https://cwiki.apache.org/confluence/display/TUSCANYWIKI) Pages - Develop websocket binding for Apache Tuscany created by moga_florian (06:35 AM) https://cwiki.apache.org/confluence/display/TUSCANYWIKI/Develop+websocket+binding+for+Apache+Tuscany GSoC 2011 Applications edited by moga_florian (06:32 AM) https://cwiki.apache.org/confluence/display/TUSCANYWIKI/GSoC+2011+Applications Apache MINA Vysper (https://cwiki.apache.org/confluence/display/VYSPER) Pages - SOCKS5 bytestream module created by ngn (08:19 AM) https://cwiki.apache.org/confluence/display/VYSPER/SOCKS5+bytestream+module Documentation edited by ngn (09:58 AM) https://cwiki.apache.org/confluence/display/VYSPER/Documentation Standards support edited by ngn (09:57 AM) https://cwiki.apache.org/confluence/display/VYSPER/Standards+support Change your notification preferences: https://cwiki.apache.org/confluence/users/view