jsf 2 - Modify the value of p:menuitem - primefaces -
i think it's small problem. modify attibute value of p:menubutton want take value user bean (after inscription in application), such take name of user (getname).
i did :
<p:menubutton value="#{user.getname}"> <p:menuitem value="my profile" action="#{toolbarview.edit}" update="" icon="ui-icon-disk" /> <p:menuitem value="log out" actionlistener="#{toolbarview.close}" update="" icon="ui-icon-arrowrefresh-1-w" /> </p:menubutton>
but had issue in interface graphic (when enter localhost):
type exception report message description server encountered internal error () prevented fulfilling request. exception javax.servlet.servletexception: /profile.xhtml @55,53 value="#{user.getname}": property 'getname' not found on type com.live.beans.user javax.faces.webapp.facesservlet.service(facesservlet.java:606) root cause javax.el.propertynotfoundexception: /profile.xhtml @55,53 value="#{user.getname}": property 'getname' not found on type com.live.beans.user com.sun.faces.facelets.el.tagvalueexpression.getvalue(tagvalueexpression.java:111) javax.faces.component.componentstatehelper.eval(componentstatehelper.java:194) org.primefaces.component.menubutton.menubutton.getvalue(menubutton.java:96) org.primefaces.component.menubutton.menubuttonrenderer.encodebutton(menubuttonrenderer.java:64) org.primefaces.component.menubutton.menubuttonrenderer.encodemarkup(menubuttonrenderer.java:53) org.primefaces.component.menu.basemenurenderer.encodeend(basemenurenderer.java:113) javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:875) org.primefaces.renderkit.corerenderer.renderchild(corerenderer.java:88) org.primefaces.renderkit.corerenderer.renderchildren(corerenderer.java:71) org.primefaces.component.column.renderer.panelgridbodycolumnrenderer.encode(panelgridbodycolumnrenderer.java:41) org.primefaces.component.column.columnrenderer.encodeend(columnrenderer.java:50) javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:875) org.primefaces.renderkit.corerenderer.renderchild(corerenderer.java:88) org.primefaces.renderkit.corerenderer.renderchildren(corerenderer.java:71) org.primefaces.component.row.renderer.panelgridbodyrowrenderer.encode(panelgridbodyrowrenderer.java:33) org.primefaces.component.row.rowrenderer.encodeend(rowrenderer.java:50) javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:875) javax.faces.component.uicomponent.encodeall(uicomponent.java:1786) javax.faces.render.renderer.encodechildren(renderer.java:168) javax.faces.component.uicomponentbase.encodechildren(uicomponentbase.java:845) javax.faces.component.uicomponent.encodeall(uicomponent.java:1779) org.primefaces.component.panelgrid.panelgridrenderer.encodestaticbody(panelgridrenderer.java:155) org.primefaces.component.panelgrid.panelgridrenderer.encodetablebody(panelgridrenderer.java:104) org.primefaces.component.panelgrid.panelgridrenderer.encodetablelayout(panelgridrenderer.java:65) org.primefaces.component.panelgrid.panelgridrenderer.encodeend(panelgridrenderer.java:37) javax.faces.component.uicomponentbase.encodeend(uicomponentbase.java:875) javax.faces.component.uicomponent.encodeall(uicomponent.java:1786) javax.faces.component.uicomponent.encodeall(uicomponent.java:1782) javax.faces.component.uicomponent.encodeall(uicomponent.java:1782) javax.faces.component.uicomponent.encodeall(uicomponent.java:1782) com.sun.faces.application.view.faceletviewhandlingstrategy.renderview(faceletviewhandlingstrategy.java:402) com.sun.faces.application.view.multiviewhandler.renderview(multiviewhandler.java:125) com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:121) com.sun.faces.lifecycle.phase.dophase(phase.java:101) com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:139) javax.faces.webapp.facesservlet.service(facesservlet.java:594)
and bean user :
@managedbean(name="user") public class user { private int id; private string name; @column(unique=true) private string email; private string password; private string confirmationpass; public user() { super(); } public int getid() { return id; } public void setid(int id) { this.id = id; } public string getname() { return name; } public void setname(string name) { this.name = name; } public string getemail() { return email; } public void setemail(string email) { this.email = email; } public string getpassword() { return password; } public void setpassword(string password) { this.password = password; } public string getconfirmationpass() { return confirmationpass; } public void setconfirmationpass(string confirmationpass) { this.confirmationpass = confirmationpass; } public user(int id, string name, string email, string password, string confirmationpass) { super(); this.id = id; this.name = name; this.email = email; this.password = password; this.confirmationpass = confirmationpass; } public user(int id, string name, string email, string password) { super(); this.id = id; this.name = name; this.email = email; this.password = password; } public user(string name, string email, string password) { super(); this.name = name; this.email = email; this.password = password; } @override public string tostring() { return "user [id=" + id + ", name=" + name + ", email=" + email + ", password=" + password + "]"; } }
also when use user.name
instead of user.getname
had nothing on interface graphic did value=" "
display nothing in interface graphic.
<p:menubutton value="#{user.name}"> <p:menuitem value="my profile" action="#{toolbarview.edit}" update="" icon="ui-icon-disk" /> <p:menuitem value="log out" actionlistener="#{toolbarview.close}" update="" icon="ui-icon-arrowrefresh-1-w" /> </p:menubutton>
thanks me
ok, change properti(value="#{user.getname}">) name getname name , assingh in "user" bean propertiy "name" it's getters , settes.
Comments
Post a Comment