From c5143e7c8eefcc4246291763c518c67aec43c608 Mon Sep 17 00:00:00 2001 From: Bauke Scholtz Date: Fri, 6 Sep 2024 07:07:12 -0400 Subject: [PATCH] Fix #5488: non-action ajax event shouldn't trigger action event; while at it also cleaned up existing code comments --- .../renderkit/html_basic/ButtonRenderer.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/impl/src/main/java/com/sun/faces/renderkit/html_basic/ButtonRenderer.java b/impl/src/main/java/com/sun/faces/renderkit/html_basic/ButtonRenderer.java index b2c2b4bf16..e851f26c04 100644 --- a/impl/src/main/java/com/sun/faces/renderkit/html_basic/ButtonRenderer.java +++ b/impl/src/main/java/com/sun/faces/renderkit/html_basic/ButtonRenderer.java @@ -171,29 +171,17 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce */ private static boolean wasClicked(FacesContext context, UIComponent component, String clientId) { - // Was our command the one that caused this submission? - // we don' have to worry about getting the value from request parameter - // because we just need to know if this command caused the submission. We - // can get the command name by calling currentValue. This way we can - // get around the IE bug. - if (clientId == null) { clientId = component.getClientId(context); } if (context.getPartialViewContext().isAjaxRequest()) { - return BEHAVIOR_SOURCE_PARAM.getValue(context).equals(clientId); + return RenderKitUtils.isPartialOrBehaviorAction(context, clientId); } else { Map requestParameterMap = context.getExternalContext().getRequestParameterMap(); if (requestParameterMap.get(clientId) == null) { - - // Check to see whether we've got an action event - // as a result of a partial/behavior postback. - if (RenderKitUtils.isPartialOrBehaviorAction(context, clientId)) { - return true; - } - + // Check to see whether we've got an action event from button of type="image" StringBuilder builder = new StringBuilder(clientId); String xValue = builder.append(".x").toString(); builder.setLength(clientId.length());