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.