Unable to save dynamic action with clientid
Hi,
I've an heavy dynamic application in JSF 2.2 running on Wildfly 12.0 (single page web app) it's currently migrated from Jboss AS 7.0 . I encounter a lot of messages : unable to save dynamic action with clientid. It seems after debugging that the problem is coming from the class : StateContext method handleAddRemoveWithAutoPrune.
In my case ; struct.action = 'REMOVE' and firstIndex = -1 so it will add the component to the actionList and the map instead of not adding it. So the next JSF Ajax Function called will log the error message "unable to save dynamic action with clientid". I've added some logging to see if my component was dynamically added to the actionList but it was not the case ; maybe it's because of my typical application.
With the correction, error messages dissappears and application seems ok.
Sorry, i've no use case to provide for the moment.
What do you think ?
Thanks,
if (firstIndex == -1) {
if (ComponentStruct.ADD.equals(struct.action)) {
actionList.add(struct);
componentMap.put(struct.clientId, component);
}
}
To illustrate the error :
When you click on the button, outputText is removed (No error Message). The second time you click on the button you have the error : unable to save dynamic action with clientid.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<h:head>
Dynamic 1
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="1">
<h:commandButton value="Remove" action="#{dynamicUi1Controller.remove}"/>
</h:panelGrid>
<h:panelGrid id="panelGrid" binding="#{dynamicUi1Controller.panelGrid}">
</h:panelGrid>
</h:form>
</h:body>
</html>
@Named
@SessionScoped
public class DynamicUi1Controller implements Serializable {
private HtmlPanelGrid panelGrid;
private HtmlOutputText outputText;
public HtmlPanelGrid getPanelGrid() {
if (panelGrid == null) {
HtmlPanelGrid component = (HtmlPanelGrid) FacesContext.getCurrentInstance().getApplication()
.createComponent(HtmlPanelGrid.COMPONENT_TYPE);
component.setColumns(1);
component.getChildren().add(getOutputText());
panelGrid = component;
}
return panelGrid;
}
public void setPanelGrid(HtmlPanelGrid panelGrid) {
this.panelGrid = panelGrid;
if (panelGrid.getChildren().size() > 0) {
setOutputText((HtmlOutputText) panelGrid.getChildren().get(0));
}
}
public HtmlOutputText getOutputText() {
if (outputText == null) {
HtmlOutputText component = (HtmlOutputText) FacesContext.getCurrentInstance().getApplication()
.createComponent(HtmlOutputText.COMPONENT_TYPE);
component.setValue("test");
outputText = component;
}
return outputText;
}
public void setOutputText(HtmlOutputText outputText) {
this.outputText = outputText;
}
public String remove() {
getPanelGrid().getChildren().clear();
return null;
}
}
mojarra issue tracker moved to: https://github.com/eclipse-ee4j/mojarra