I get this error when I click on a p:commandButton in my page
java.lang.IllegalStateException: PWC3999: Cannot create a session
after the response has been committed
The button is in an h:form and looks like this:
<p:commandButton value="Save" action="#{discussionManager.save}" ajax="false"/>
But an h:commandButton works fine:
<h:commandButton value="Save" action="#{discussionManager.save}"/> (this works)
This is the bean with the method in it
@Named
@RequestScoped
public class DiscussionManager {
private static final Logger logger = Logger.getLogger("DiscussionManager");
@Inject
private DiscussionDao discussionDao;
private Discussion discussion = new Discussion();
@Produces
@Named
@RequestScoped
public Discussion getDiscussion() {
return discussion;
}
public String save() {
logger.info("Hello");
discussionDao.create(discussion);
return "list";
}
}
I’ve waited all day before posting this question because I feel like I should know how to get this working. But I’ve read and re-read my book, and loads of other posts. I just don’t understand why it’s not working.
I can’t comment on your final answer so I have to add another answer. I believe what you did to make your example work was to add widgetVar to your editor component. I had this problem as well. The example on the PrimeFaces Demo wouldn’t work properly until I added the widgetVar line. You need to reference the widgetVar name in your onclick call rather than the id. I use different names between the id and widgetVar for clarity so I would change your editor code to:
I hope that helps clarify.