java - JSF Action is not called -


Once again I have a problem that I can not solve.

A Managed Been

@ Named (Value = "Change Infobia") @ Request Public Category ChangeInfoBean {Private String Email; Private string first name; Personal string last name; / ** ChangeInfoBean * / Public ChangeInfoBean () creates a new example {FacesContext reference = FacesContext.getCurrentInstance (); // User who is currently logged in LoginBean Bean = (Login) context.getExternalContext (). GetSessionMap () Get ("loginBean"); BasicUser user = bean.getUser (); This.email = user.getEmail (); This.firstName = user.getFirstName (); This.lastName = user.getLlastName (); } Public string changeName () {session session = HibernateUtil.getSessionFactory (). OpenSession (); Try {transaction tx = session.beginTransaction (); BasicUser updateUser = (BasicUser) session.load (BasicUser.class, this.email); UpdateUser.setFirstName (firstName); UpdateUser.setLastName (lastName); Tx.commit (); } Hold (exception e) {e.printStackTrace (); } Finally {session.close (); Return "succes"; }}

The return "success" is back to part of a page that uses bean

   Last name: & lt; H: Input Text id = "Last name" value = "# {changeInfoBean.lastName}" /> & Lt; F: aspect names = "footer" & gt; & Lt; H: Panel Group style = "display: block; text-line: center" & gt; & Lt; H: command button value = "submit name" action = "# {changeInfoBean.changeName}" /> & Lt; / H: panelGroup & gt; & Lt; / Ch: Aspect & gt; & Lt; / H: panelGrid & gt; & Lt; / H: form & gt; & Lt; / H: panelGroup & gt; I have examined that it runs all life cycle phase, tried to remove the Bean session and tried to set it immediately = "right". I tried to delete the input text field and left the command button only. In every case the law is not called changeName (). What can be done?   

Obviously not equal to # {param.change} "Name" is done due to not submitting the form h: panelGroup , which in turn did not implement the action of the button.

Add the following for your form:

  & lt; Input type = "hidden" name = "change" value = "# {param.change}" /> gt;  

This will maintain the # {param.change} for subsequent requests. Placing bean in the scope of the session will only work when it comes to # {sessionBean.change} .

Also see:


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -