File tree Expand file tree Collapse file tree
impl/src/main/java/com/sun/faces/renderkit/html_basic Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545import com .sun .faces .util .Util ;
4646
4747import jakarta .faces .component .NamingContainer ;
48+ import jakarta .faces .component .UICommand ;
4849import jakarta .faces .component .UIComponent ;
4950import jakarta .faces .component .UIInput ;
5051import jakarta .faces .component .UIParameter ;
@@ -579,13 +580,16 @@ protected boolean shouldWriteIdAttribute(UIComponent component) {
579580 // By default we only write the id attribute if:
580581 //
581582 // - We have a non-auto-generated id, or...
582- // - We have client behaviors.
583+ // - We have client behaviors, or...
584+ // - The component is a UICommand (its CSP-style click listener is attached
585+ // via mojarra.ael(clientId, ...) which needs the id on the rendered element).
583586 //
584587 // We assume that if client behaviors are present, they
585588 // may need access to the id (AjaxBehavior certainly does).
586589
587590 String id ;
588591 return null != (id = component .getId ()) && (!id .startsWith (UIViewRoot .UNIQUE_ID_PREFIX )
592+ || component instanceof UICommand
589593 || component instanceof ClientBehaviorHolder && !((ClientBehaviorHolder ) component ).getClientBehaviors ().isEmpty ());
590594 }
591595
You can’t perform that action at this time.
0 commit comments