diff --git a/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandButtonRenderer.java b/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandButtonRenderer.java index ca9f3edc..7ea15b1d 100644 --- a/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandButtonRenderer.java +++ b/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandButtonRenderer.java @@ -43,7 +43,7 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoComponentRenderer private static String[] ATTRIBUTES_TO_RENDER; - private static String BUTTON_TAG_NAME = "button"; + private static String INPUT_TAG_NAME = "input"; static { List tempList = new ArrayList(); @@ -120,7 +120,7 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoComponentRenderer } protected String getRenderedTagName(UIComponent component) { - return BUTTON_TAG_NAME; + return INPUT_TAG_NAME; } public void decode(FacesContext context, UIComponent component) { @@ -129,18 +129,8 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoComponentRenderer } } - public void encodeChildren(FacesContext context, UIComponent component) throws IOException { - // If the button has no children, render out the "value" as text. - ResponseWriter writer = context.getResponseWriter(); - String valueAttr = "value"; - if (component.getAttributes().get(valueAttr) != null) { - writer.writeText(component.getAttributes().get(valueAttr), valueAttr); - } - super.encodeChildren(context, component); - } - public boolean getRendersChildren() { - return true; + return false; } protected String encodeParamsAsObject(FacesContext context, UIComponent component) { diff --git a/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandLinkRenderer.java b/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandLinkRenderer.java index 51f7aae0..ec7e1319 100644 --- a/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandLinkRenderer.java +++ b/spring-faces/src/main/java/org/springframework/faces/ui/ProgressiveCommandLinkRenderer.java @@ -89,6 +89,14 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend } }; + private RenderAttributeCallback noOpCallback = new RenderAttributeCallback() { + + public void doRender(FacesContext context, ResponseWriter writer, UIComponent component, String attribute, + Object attributeValue, String property) throws IOException { + // No-op + } + }; + public void encodeBegin(FacesContext context, UIComponent component) throws IOException { // No need to be progressive if this is an AJAX request since it can be assumed JavaScript is enabled if (!JsfUtils.isAsynchronousFlowRequest()) { @@ -114,6 +122,16 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend super.encodeBegin(context, component); } + public void encodeChildren(FacesContext context, UIComponent component) throws IOException { + // If the link has no children, render out the "value" as text. + ResponseWriter writer = context.getResponseWriter(); + String valueAttr = "value"; + if (component.getAttributes().get(valueAttr) != null) { + writer.writeText(component.getAttributes().get(valueAttr), valueAttr); + } + super.encodeChildren(context, component); + } + public void encodeEnd(FacesContext context, UIComponent component) throws IOException { super.encodeEnd(context, component); @@ -147,6 +165,10 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend ResourceHelper.endScriptBlock(context); } + public boolean getRendersChildren() { + return true; + } + protected String[] getAttributesToRender(UIComponent component) { return ATTRIBUTES_TO_RENDER; } @@ -161,6 +183,7 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend attributeCallbacks.putAll(super.getAttributeCallbacks(component)); attributeCallbacks.put("href", hrefCallback); attributeCallbacks.put("class", classCallback); + attributeCallbacks.put("type", noOpCallback); } return attributeCallbacks; }