Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Unable to save dynamic action with clientid #4395

Open
smalltox opened this issue Mar 7, 2019 · 2 comments
Open

Unable to save dynamic action with clientid #4395

smalltox opened this issue Mar 7, 2019 · 2 comments

Comments

@smalltox
Copy link

smalltox commented Mar 7, 2019

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);
}
}

@smalltox smalltox changed the title handleAdd Dynamic Components Mar 7, 2019
@smalltox
Copy link
Author

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;
	}
}

@smalltox smalltox changed the title Dynamic Components Unable to save dynamic action with clientid Mar 11, 2019
@erickdeoliveiraleal
Copy link

mojarra issue tracker moved to: https://github.com/eclipse-ee4j/mojarra

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants