You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/05/02 17:07:01 UTC

svn commit: r1098620 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java

Author: lu4242
Date: Mon May  2 15:07:01 2011
New Revision: 1098620

URL: http://svn.apache.org/viewvc?rev=1098620&view=rev
Log:
TOMAHAWK-1578 Quotes are not escaped in TableAutoSuggest in ajax requests (thanks to Marcus Büttner for provide this patch)

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java?rev=1098620&r1=1098619&r2=1098620&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/tablesuggestajax/TableSuggestAjaxRenderer.java Mon May  2 15:07:01 2011
@@ -313,7 +313,7 @@ public class TableSuggestAjaxRenderer ex
                                 htmlOutputText.getFor());
                         response.append("\"").append(forText).append("\",");
                         response.append("\"label\": ");
-                        response.append("\"").append(htmlOutputText.getLabel()).append("\"");
+                        response.append("\"").append(escapeQuotes(htmlOutputText.getLabel())).append("\"");
                     }
                     //foreign-key field is a combo-box field 
                     else if (htmlOutputText.getForValue() != null)
@@ -324,12 +324,12 @@ public class TableSuggestAjaxRenderer ex
                                 htmlOutputText.getForValue());
                         response.append("\"").append(forValue).append("\",");
                         response.append("\"label\": ");
-                        response.append("\"").append(htmlOutputText.getLabel()).append("\",");
+                        response.append("\"").append(escapeQuotes(htmlOutputText.getLabel())).append("\",");
                         response.append("\"value\": ");
-                        response.append("\"").append(htmlOutputText.getValue()).append("\"");
+                        response.append("\"").append(escapeQuotes(htmlOutputText.getValue().toString())).append("\"");
                     } else {
                         response.append("\"label\": ");
-                        response.append("\"").append(htmlOutputText.getValue()).append("\"");
+                        response.append("\"").append(escapeQuotes(htmlOutputText.getValue().toString())).append("\"");
                     }
                     response.append("}");
                     if (columnChildren.hasNext() || columns.hasNext()) {
@@ -350,6 +350,8 @@ public class TableSuggestAjaxRenderer ex
         
     }
 
+
+
     //renders column names in the XML response
     private void renderColumnHeaders(TableSuggestAjax tableSuggestAjax,
             FacesContext context) throws IOException