java - Error setting expression 'userBean.password' with value ['', ] -
i'm using struts 2 , tomcat together. problem i'm facing is: whenever submit data whether wrong or not (username , password) allways makes following field error appear:
.error setting expression 'userbean.password' value ['xxx', ] .error setting expression 'userbean.username' value ['yyy', ]
where 'xxx' password , 'yyy' username.
my action class is:
package direstruts.action; import static com.opensymphony.xwork2.action.success; import direstruts.model.userbean; public class loginaction extends genericaction { @override public void validate() { userbean ub = getuserbean(); if(ub.getusername().isempty()) { addfielderror("userbean.username", "por favor insira o username de utilizador"); } if(ub.getpassword().isempty()) { addfielderror("userbean.password", "por favor insira password de utilizador"); } } public string getauthentication() throws exception { if(getuserbean().getauthentication()) { addactionmessage("log in bem sucedido!"); return success; } addactionerror("utilizador e/ou password errados e/ou utilizador já está logado"); return error; } public string setnewuser() throws exception { if(getuserbean().setnewuser()) { addactionmessage("user registado!"); return success; } addactionerror("utilizador já existe! tente outro username!"); return error; } public string setquituser() throws exception { if(getuserbean().setquituser()) { addactionmessage("user loggedout!"); return success; } return error; } public userbean getuserbean() { if(!session.containskey("userbean")) this.setuserbean(new userbean()); return (userbean) session.get("userbean"); } public void setuserbean(userbean userbean) { session.put("userbean", userbean); } }
my jsp is:
<%@ taglib prefix="s" uri="/struts-tags"%> <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%><!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="css/styles.css"> <title>meeto</title> </head> <body> <s:form action="loginaction" method="post" > <s:label cssclass="login" value="please fill in form below in order register or log in:" /> <br> <s:label for="userbean.username" value="username:"/> <s:textfield name="userbean.username" /> <br> <s:label for="userbean.password" value="password:"/> <s:password name="userbean.password" /> <br> <s:submit value="login" action="loginaction" /> <br> <s:submit value="register" action="registeraction" /> <br> </s:form> <s:fielderror/> <s:actionerror/> <s:actionmessage/> </body> </
my bean is:
package direstruts.model; import cliente.replies.replylogin; import cliente.replies.replyobj; import cliente.requests.lookup.getauthentication; import cliente.requests.modify.setnewuser; import cliente.requests.modify.setquituser; import java.io.ioexception; import java.io.inputstream; import java.net.malformedurlexception; import java.rmi.naming; import java.rmi.notboundexception; import java.rmi.remoteexception; import java.util.properties; import servidorrmi.executecommands; public class userbean { executecommands ec; private static string ip_rmi = "127.0.0.1"; private static int serverrmi = 1099; private static inputstream in; private string username; private string password; private int iduser; public userbean() { readproperties(); } 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; } public int getiduser() { return this.iduser; } public void setiduser(int iduser) { this.iduser = iduser; } public boolean getauthentication() { getauthentication ga = new getauthentication(getusername(), getpassword(), 0); replylogin rl = null; boolean cond = false; do{ try { ec = (executecommands)naming.lookup("rmi://" + ip_rmi + ":" + serverrmi + "/serverrmi"); rl = ec.getauthentication(ga); cond = false; } catch (remoteexception ex) { system.err.println("erro no servidor rmi remote! tentar restablecer ligação!"); cond = true; } catch (notboundexception ex) { system.err.println("erro no servidor rmi notbound! tentar restablecer ligação!"); cond = true; } catch (malformedurlexception ex) { system.err.println("erro no servidor rmi malformedurl! tentar restablecer ligação!"); cond = true; } } while(cond); setiduser(rl.getiduser()); // faz set ao iduser para poder ser usado nos pedidos subsequentes return rl.ishasregister(); } public boolean setnewuser() { setnewuser snu = new setnewuser(getusername(), getpassword(), 0); boolean cond = false; replyobj ro = null; do{ try { ec = (executecommands)naming.lookup("rmi://" + ip_rmi + ":" + serverrmi + "/serverrmi"); ro = ec.setnewuser(snu); cond = false; } catch (remoteexception ex) { system.err.println("erro no servidor rmi remote! tentar restablecer ligação!"); cond = true; } catch (notboundexception ex) { system.err.println("erro no servidor rmi notbound! tentar restablecer ligação!"); cond = true; } catch (malformedurlexception ex) { system.err.println("erro no servidor rmi malformedurl! tentar restablecer ligação!"); cond = true; } } while(cond); return ro.getsuccess(); } public boolean setquituser() { setquituser squ = new setquituser(iduser, 0); boolean cond = false; replyobj ro = null; do{ try { ec = (executecommands)naming.lookup("rmi://" + ip_rmi + ":" + serverrmi + "/serverrmi"); ro = ec.setquituser(squ); cond = false; } catch (remoteexception ex) { system.err.println("erro no servidor rmi remote! tentar restablecer ligação!"); cond = true; } catch (notboundexception ex) { system.err.println("erro no servidor rmi notbound! tentar restablecer ligação!"); cond = true; } catch (malformedurlexception ex) { system.err.println("erro no servidor rmi malformedurl! tentar restablecer ligação!"); cond = true; } } while(cond); return ro.getsuccess(); } static public void readproperties() { try { properties properties = new properties(); in = userbean.class.getclassloader().getresourceasstream("app.properties"); properties.load(in); ip_rmi = properties.getproperty("serverrmi.address"); serverrmi = integer.parseint (properties.getproperty("serverrmi.port")); } catch(ioexception e) { system.err.println("erro ler o ficheiro .properties!"); } { if(in != null) { try { in.close(); } catch(ioexception e) {system.out.println("erro fechar!"); } } } } }
here tomcat log:
19-nov-2014 14:21:04.618 warning [http-apr-8080-exec-109] com.opensymphony.xwork2.util.logging.jdk.jdklogger.warn parameter [action:loginaction] on excludeparams list of patterns! 19-nov-2014 14:21:05.086 severe [http-apr-8080-exec-109] null.null notificação para o desenvolvedor (altere o paramêtro struts.devmode para false para desabilitar esta mensagem): unexpected exception caught setting 'userbean.password' on 'class direstruts.action.loginaction: error setting expression 'userbean.password' value ['yyy', ] 19-nov-2014 14:21:05.101 severe [http-apr-8080-exec-109] null.null notificação para o desenvolvedor (altere o paramêtro struts.devmode para false para desabilitar esta mensagem): unexpected exception caught setting 'userbean.username' on 'class direstruts.action.loginaction: error setting expression 'userbean.username' value ['xxx', ] 19-nov-2014 14:21:05.210 warning [http-apr-8080-exec-109] com.opensymphony.xwork2.util.logging.jdk.jdklogger.warn caught exception while evaluating expression 'userbean.username' against value stack caught ognl exception while getting property userbean - class: ognl.ognlruntime file: ognlruntime.java method: getmethodvalue line: 1456 - ognl/ognlruntime.java:1456:-1 @ com.opensymphony.xwork2.ognl.accessor.compoundrootaccessor.getproperty(compoundrootaccessor.java:143) @ ognl.ognlruntime.getproperty(ognlruntime.java:2317) @ ognl.astproperty.getvaluebody(astproperty.java:114) @ ognl.simplenode.evaluategetvaluebody(simplenode.java:212) @ ognl.simplenode.getvalue(simplenode.java:258) @ ognl.astchain.getvaluebody(astchain.java:141) @ ognl.simplenode.evaluategetvaluebody(simplenode.java:212) @ ognl.simplenode.getvalue(simplenode.java:258) @ ognl.ognl.getvalue(ognl.java:494) @ com.opensymphony.xwork2.ognl.ognlutil.getvalue(ognlutil.java:255) @ com.opensymphony.xwork2.ognl.ognlvaluestack.getvalue(ognlvaluestack.java:358) @ com.opensymphony.xwork2.ognl.ognlvaluestack.tryfindvalue(ognlvaluestack.java:347) @ com.opensymphony.xwork2.ognl.ognlvaluestack.tryfindvaluewhenexpressionisnotnull(ognlvaluestack.java:322) @ com.opensymphony.xwork2.ognl.ognlvaluestack.findvalue(ognlvaluestack.java:308) @ com.opensymphony.xwork2.ognl.ognlvaluestack.findvalue(ognlvaluestack.java:366) @ com.opensymphony.xwork2.util.textparseutil$1.evaluate(textparseutil.java:157) @ com.opensymphony.xwork2.util.ognltextparser.evaluate(ognltextparser.java:49) @ com.opensymphony.xwork2.util.textparseutil.translatevariables(textparseutil.java:167) @ com.opensymphony.xwork2.util.textparseutil.translatevariables(textparseutil.java:112) @ com.opensymphony.xwork2.util.textparseutil.translatevariables(textparseutil.java:85) @ org.apache.struts2.components.component.findvalue(component.java:353) @ org.apache.struts2.components.uibean.evaluateparams(uibean.java:813) @ org.apache.struts2.components.uibean.end(uibean.java:544) @ org.apache.struts2.views.jsp.componenttagsupport.doendtag(componenttagsupport.java:42) @ org.apache.jsp.loginpage_jsp._jspx_meth_s_005ftextfield_005f0(loginpage_jsp.java:273) @ org.apache.jsp.loginpage_jsp._jspx_meth_s_005fform_005f0(loginpage_jsp.java:182) @ org.apache.jsp.loginpage_jsp._jspservice(loginpage_jsp.java:114) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:725) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:396) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:340) @ javax.servlet.http.httpservlet.service(httpservlet.java:725) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:291) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.applicationdispatcher.invoke(applicationdispatcher.java:721) @ org.apache.catalina.core.applicationdispatcher.processrequest(applicationdispatcher.java:466) @ org.apache.catalina.core.applicationdispatcher.doforward(applicationdispatcher.java:391) @ org.apache.catalina.core.applicationdispatcher.forward(applicationdispatcher.java:318) @ org.apache.struts2.dispatcher.servletdispatcherresult.doexecute(servletdispatcherresult.java:164) @ org.apache.struts2.dispatcher.strutsresultsupport.execute(strutsresultsupport.java:186) @ com.opensymphony.xwork2.defaultactioninvocation.executeresult(defaultactioninvocation.java:371) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:275) @ org.apache.struts2.impl.strutsactionproxy.execute(strutsactionproxy.java:54) @ org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:562) @ org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:99) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:506) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:142) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:537) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1081) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:658) @ org.apache.coyote.http11.http11aprprotocol$http11connectionhandler.process(http11aprprotocol.java:277) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.dorun(aprendpoint.java:2403) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.run(aprendpoint.java:2392) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(thread.java:745) caused by: ognl.ognlexception: userbean [java.lang.nullpointerexception] @ ognl.ognlruntime.getmethodvalue(ognlruntime.java:1456) @ ognl.objectpropertyaccessor.getpossibleproperty(objectpropertyaccessor.java:60) @ ognl.objectpropertyaccessor.getproperty(objectpropertyaccessor.java:147) @ com.opensymphony.xwork2.ognl.accessor.objectaccessor.getproperty(objectaccessor.java:17) @ ognl.ognlruntime.getproperty(ognlruntime.java:2317) @ com.opensymphony.xwork2.ognl.accessor.compoundrootaccessor.getproperty(compoundrootaccessor.java:138) ... 68 more caused by: java.lang.nullpointerexception @ java.util.properties$linereader.readline(properties.java:434) @ java.util.properties.load0(properties.java:353) @ java.util.properties.load(properties.java:341) @ direstruts.model.userbean.readproperties(userbean.java:128) @ direstruts.model.userbean.<init>(userbean.java:27) @ direstruts.action.loginaction.getuserbean(loginaction.java:46) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:483) @ ognl.ognlruntime.invokemethod(ognlruntime.java:891) @ ognl.ognlruntime.getmethodvalue(ognlruntime.java:1454) ... 73 more 19-nov-2014 14:21:05.288 warning [http-apr-8080-exec-109] com.opensymphony.xwork2.util.logging.jdk.jdklogger.warn note: previous warning message issued due devmode set true. 19-nov-2014 14:21:05.429 warning [http-apr-8080-exec-109] com.opensymphony.xwork2.util.logging.jdk.jdklogger.warn caught exception while evaluating expression 'userbean.password' against value stack caught ognl exception while getting property userbean - class: ognl.ognlruntime file: ognlruntime.java method: getmethodvalue line: 1456 - ognl/ognlruntime.java:1456:-1 @ com.opensymphony.xwork2.ognl.accessor.compoundrootaccessor.getproperty(compoundrootaccessor.java:143) @ ognl.ognlruntime.getproperty(ognlruntime.java:2317) @ ognl.astproperty.getvaluebody(astproperty.java:114) @ ognl.simplenode.evaluategetvaluebody(simplenode.java:212) @ ognl.simplenode.getvalue(simplenode.java:258) @ ognl.astchain.getvaluebody(astchain.java:141) @ ognl.simplenode.evaluategetvaluebody(simplenode.java:212) @ ognl.simplenode.getvalue(simplenode.java:258) @ ognl.ognl.getvalue(ognl.java:494) @ com.opensymphony.xwork2.ognl.ognlutil.getvalue(ognlutil.java:255) @ com.opensymphony.xwork2.ognl.ognlvaluestack.getvalue(ognlvaluestack.java:358) @ com.opensymphony.xwork2.ognl.ognlvaluestack.tryfindvalue(ognlvaluestack.java:347) @ com.opensymphony.xwork2.ognl.ognlvaluestack.tryfindvaluewhenexpressionisnotnull(ognlvaluestack.java:322) @ com.opensymphony.xwork2.ognl.ognlvaluestack.findvalue(ognlvaluestack.java:308) @ com.opensymphony.xwork2.ognl.ognlvaluestack.findvalue(ognlvaluestack.java:366) @ com.opensymphony.xwork2.util.textparseutil$1.evaluate(textparseutil.java:157) @ com.opensymphony.xwork2.util.ognltextparser.evaluate(ognltextparser.java:49) @ com.opensymphony.xwork2.util.textparseutil.translatevariables(textparseutil.java:167) @ com.opensymphony.xwork2.util.textparseutil.translatevariables(textparseutil.java:112) @ com.opensymphony.xwork2.util.textparseutil.translatevariables(textparseutil.java:85) @ org.apache.struts2.components.component.findvalue(component.java:353) @ org.apache.struts2.components.uibean.evaluateparams(uibean.java:813) @ org.apache.struts2.components.uibean.end(uibean.java:544) @ org.apache.struts2.views.jsp.componenttagsupport.doendtag(componenttagsupport.java:42) @ org.apache.jsp.loginpage_jsp._jspx_meth_s_005fpassword_005f0(loginpage_jsp.java:313) @ org.apache.jsp.loginpage_jsp._jspx_meth_s_005fform_005f0(loginpage_jsp.java:191) @ org.apache.jsp.loginpage_jsp._jspservice(loginpage_jsp.java:114) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:725) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:396) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:340) @ javax.servlet.http.httpservlet.service(httpservlet.java:725) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:291) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.applicationdispatcher.invoke(applicationdispatcher.java:721) @ org.apache.catalina.core.applicationdispatcher.processrequest(applicationdispatcher.java:466) @ org.apache.catalina.core.applicationdispatcher.doforward(applicationdispatcher.java:391) @ org.apache.catalina.core.applicationdispatcher.forward(applicationdispatcher.java:318) @ org.apache.struts2.dispatcher.servletdispatcherresult.doexecute(servletdispatcherresult.java:164) @ org.apache.struts2.dispatcher.strutsresultsupport.execute(strutsresultsupport.java:186) @ com.opensymphony.xwork2.defaultactioninvocation.executeresult(defaultactioninvocation.java:371) @ com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:275) @ org.apache.struts2.impl.strutsactionproxy.execute(strutsactionproxy.java:54) @ org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:562) @ org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:99) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:506) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:142) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:537) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1081) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:658) @ org.apache.coyote.http11.http11aprprotocol$http11connectionhandler.process(http11aprprotocol.java:277) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.dorun(aprendpoint.java:2403) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.run(aprendpoint.java:2392) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(thread.java:745) caused by: ognl.ognlexception: userbean [java.lang.nullpointerexception] @ ognl.ognlruntime.getmethodvalue(ognlruntime.java:1456) @ ognl.objectpropertyaccessor.getpossibleproperty(objectpropertyaccessor.java:60) @ ognl.objectpropertyaccessor.getproperty(objectpropertyaccessor.java:147) @ com.opensymphony.xwork2.ognl.accessor.objectaccessor.getproperty(objectaccessor.java:17) @ ognl.ognlruntime.getproperty(ognlruntime.java:2317) @ com.opensymphony.xwork2.ognl.accessor.compoundrootaccessor.getproperty(compoundrootaccessor.java:138) ... 68 more caused by: java.lang.nullpointerexception @ java.util.properties$linereader.readline(properties.java:434) @ java.util.properties.load0(properties.java:353) @ java.util.properties.load(properties.java:341) @ direstruts.model.userbean.readproperties(userbean.java:128) @ direstruts.model.userbean.<init>(userbean.java:27) @ direstruts.action.loginaction.getuserbean(loginaction.java:46) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:483) @ ognl.ognlruntime.invokemethod(ognlruntime.java:891) @ ognl.ognlruntime.getmethodvalue(ognlruntime.java:1454) ... 73 more 19-nov-2014 14:21:05.507 warning [http-apr-8080-exec-109] com.opensymphony.xwork2.util.logging.jdk.jdklogger.warn note: previous warning message issued due devmode set true.
[edit] forgot mention have action in other actions extend. here is:
package direstruts.action; import com.opensymphony.xwork2.actionsupport; import java.util.map; import org.apache.struts2.interceptor.sessionaware; public class genericaction extends actionsupport implements sessionaware{ protected static final long serialversionuid = 4l; protected map<string, object> session; @override public void setsession(map<string, object> session) { this.session = session; } }
to preserve action memory, genericaction implements sessionaware. ok?
as reported in parameters interceptor documentation (and explained in answer), exception:
.error setting expression 'userbean.password' value ['xxx', ]
means missin setter.
javabeans convention establishes should have property, getter , setter same name, , struts2 works following principles, performing introspection through reflection outline action's objects.
what have in code instead ?
public userbean getuserbean() { if(!session.containskey("userbean")) this.setuserbean(new userbean()); return (userbean) session.get("userbean"); } public void setuserbean(userbean userbean) { session.put("userbean", userbean); }
a little un-standard, uh !
the property private userbean userbean;
not exists, , getters , setters doing strange session things (while should not have business).
change
private userbean userbean; public userbean getuserbean() { return userbean; } public void setuserbean(userbean userbean) { this.userbean = userbean; }
and work.
then if needed, find way deal session , object (like prepare()
method, or execute()
).
Comments
Post a Comment