JSF 2.2 java.lang.IllegalStateException: Cannot create a session after the response has been committed -
i've developed web apps using jsf 2.0 , decided write app using myfaces 2.2 , tomcat 7.0.35. exceptions , can't understand reason of this. khow stacktrace similar mojara bug use myfaces.
java.lang.illegalstateexception: cannot create session after response has been committed org.apache.catalina.connector.request.dogetsession(request.java:2881) org.apache.catalina.connector.request.getsession(request.java:2316) org.apache.catalina.connector.requestfacade.getsession(requestfacade.java:898) org.apache.myfaces.context.servlet.servletexternalcontextimpl.getsession(servletexternalcontextimpl.java:150) org.apache.myfaces.view.impl.defaultviewscopehandler.generateviewscopeid(defaultviewscopehandler.java:128) org.apache.myfaces.view.viewscopeproxymap.getwrapped(viewscopeproxymap.java:76) org.apache.myfaces.view.viewscopeproxymap.isempty(viewscopeproxymap.java:94) org.apache.myfaces.renderkit.errorpagewriter._writevariables(errorpagewriter.java:787) org.apache.myfaces.renderkit.errorpagewriter._writevariables(errorpagewriter.java:769) org.apache.myfaces.renderkit.errorpagewriter.debughtml(errorpagewriter.java:356) org.apache.myfaces.renderkit.errorpagewriter.handle(errorpagewriter.java:470) org.apache.myfaces.context.myfacesexceptionhandlerwrapperimpl.handle(myfacesexceptionhandlerwrapperimpl.java:301) javax.faces.context.exceptionhandlerwrapper.handle(exceptionhandlerwrapper.java:61) org.apache.myfaces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:287) javax.faces.webapp.facesservlet.service(facesservlet.java:200)
it's page
<h:body> <h:inputtext value="#{loginbean.username}"/> <h:inputsecret value="#{loginbean.password}"/> <h:commandbutton value="login"/> <!-- jquery (necessary bootstrap's javascript plugins) --> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <h:outputscript name="lib/bootstrap.min.js" library="js" target="body"/> </h:body> @managedbean(name = "loginbean") @requestscoped public class loginbean implements serializable{ private string username; private string password; @postconstruct public void init(){ username = ""; password = ""; } public void validatecredentials(){ } public string getusername() { return username; } public void setusername(string username) { this.username = username; } public string getpassword() { return password; } public void setpassword(string password) { this.password = password; } }
what can reason of problem?
try add:
<h:form rendered="#{loginbean.initok}"> <h:inputtext value="#{loginbean.username}"/> <h:inputsecret value="#{loginbean.password}"/> <h:commandbutton value="login"/> ............ <h:from> @managedbean(name = "loginbean") @requestscoped public class loginbean implements serializable{ private string username; private string password; private boolean initok; @postconstruct public void init(){ username = ""; password = ""; initok =true; } getter setter...
Comments
Post a Comment