Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The main problem is that you have two User objects:</p> <ul> <li>User <strong>u</strong> - currently selected user. </li> <li>User <strong>user</strong> - just a ManagedBean, most probably with no state (no id, no name, no address).</li> </ul> <p>When performing the edit operation you try to use <strong>u.id</strong> and <strong>user.name</strong>, <strong>user.address</strong>, etc. What you need to do, is to take all the values from the <strong>u</strong> object.</p> <p>There are many different approaches (I've never used the third one, but it should work and it's the closest to what you've already have):</p> <p><strong>A1</strong>. You can keep currently selected object in your UserBean and set it with setPropertyActionListener:</p> <pre><code>&lt;f:setPropertyActionListener target="#{userBean.selectedUser}" value="#{u}" /&gt; </code></pre> <p>Then you can call the edit method implemented in the same bean (it has full access to selectedUser object and it can implement the edit itself of just delegate the action to object with edit method implementation).</p> <p><strong>A2</strong>. You can place your edit method in the UserBean and pass entire User object as a parameter:</p> <pre><code>&lt;h:commandButton value="Save" action="#{userBean.editData(u)}" /&gt; </code></pre> <p><strong>A3</strong>. Or you can just call:</p> <pre><code>&lt;h:commandButton value="Save" action="#{u.editData()}" /&gt; </code></pre> <p>instead of:</p> <pre><code>&lt;h:commandButton value="Save" action="#{user.editData(u.userID)}" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload