Note that there are some explanatory texts on larger screens.

plurals
  1. POAction method not being called on second, third h:commandbutton after first button is clicked in jsf
    primarykey
    data
    text
    <p>I have a JSF page that I intend on using to edit a user's information. All of the components needed for editing the user are included in the same pag an dI'm using the render attribute to determine which components should be rendered. The first panel group is rendered and when you enter the users login name and click the button everything works just fine and the second panel group is displayed and you can change the users information in the text fields. The problem comes in with the clicking the button in the first tab of the accordian panel, it doesn't work. I've tried request scope and view scope and have the same problem when using either one.</p> <pre><code> &lt;f:view contentType="text/html"&gt; &lt;h:head&gt; &lt;f:facet name="first"&gt; &lt;meta http-equiv="X-UA-Compatible" content="EmulateIE8" /&gt; &lt;meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/&gt; &lt;title&gt;&lt;/title&gt; &lt;/f:facet&gt; &lt;/h:head&gt; &lt;h:body styleClass="pageDefaultBGC"&gt; &lt;p:layout fullPage="true"&gt; &lt;f:facet name="last"&gt; &lt;h:outputStylesheet library="css" name="discovery.css"&gt;&lt;/h:outputStylesheet&gt; &lt;/f:facet&gt; &lt;p:layoutUnit styleClass="headerDiv" position="north" size="100"&gt; &lt;h:graphicImage library="images" name="header.jpg"&gt;&lt;/h:graphicImage&gt; &lt;/p:layoutUnit&gt; &lt;p:layoutUnit styleClass="navDiv" position="west" size="200"&gt; &lt;h:outputText value="Navigation Menu"&gt;&lt;/h:outputText&gt; &lt;br/&gt; &lt;hr/&gt; &lt;h:outputLink styleClass="navLink" value="index.xhtml"&gt;Admin Home&lt;/h:outputLink&gt; &lt;br/&gt; &lt;h:outputLink styleClass="navLink" value="addNewUser.xhtml"&gt;Add New User&lt;/h:outputLink&gt; &lt;br/&gt; &lt;h:outputLink styleClass="navLink" value="edituser.xhtml"&gt;Edit User&lt;/h:outputLink&gt; &lt;br/&gt; &lt;/p:layoutUnit&gt; &lt;p:layoutUnit position="center" id="main"&gt; &lt;h:form id="editForm"&gt; &lt;h:panelGroup rendered="#{!adminManagedBean.editingUser}"&gt; &lt;h2&gt;Edit User Account&lt;/h2&gt; &lt;h:outputLabel for="useredit" value="Enter User's Name:"&gt;&lt;/h:outputLabel&gt; &lt;h:inputText id="useredit" value="#{adminManagedBean.editUserLogin}" required="true"&gt;&lt;/h:inputText&gt; &lt;br/&gt;&lt;br/&gt; THIS BUTTON WORKS!---&gt;&lt;h:commandButton value="Submit" action="#{adminManagedBean.startUserEdit()}"&gt;&lt;/h:commandButton&gt; &lt;/h:panelGroup&gt; &lt;h:panelGroup rendered="#{adminManagedBean.editingUser}"&gt; &lt;h:outputText value="Editing User:"&gt;&lt;/h:outputText&gt; &lt;p:dataTable value="#{adminManagedBean.editUser}" var="u"&gt; &lt;p:column styleClass="dataTableHeader" headerText="Full Name"&gt;#{u.firstName}&amp;nbsp;#{u.lastName}&lt;/p:column&gt; &lt;p:column styleClass="dataTableHeader" headerText="Username"&gt;#{u.login}&lt;/p:column&gt; &lt;p:column styleClass="dataTableHeader" headerText="Phone"&gt;#{u.phone}&lt;/p:column&gt; &lt;p:column styleClass="dataTableHeader" headerText="Email"&gt;#{u.email}&lt;/p:column&gt; &lt;p:column styleClass="dataTableHeader" headerText="Agency ID"&gt;#{u.agencyId}&lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;br/&gt; &lt;h:outputText value="User's Current Roles"&gt;&lt;/h:outputText&gt; &lt;ul&gt; &lt;ui:repeat value="#{adminManagedBean.editUsersRoles}" var="cr"&gt; &lt;li&gt;&lt;h:outputText value="#{cr}"&gt;&lt;/h:outputText&gt;&lt;/li&gt; &lt;/ui:repeat&gt; &lt;/ul&gt; &lt;br/&gt; &lt;h:outputText value="Select an item to edit using the menu below"&gt;&lt;/h:outputText&gt; &lt;br/&gt; &lt;p:accordionPanel&gt; &lt;p:tab title="Edit User's Name" titleStyleClass="accordianTitleStyle"&gt; &lt;h:panelGrid styleClass="panelGridStyle1" columns="2" cellpadding="10"&gt; &lt;h:outputText value="First Name:"&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{adminManagedBean.editUser.firstName}"&gt;&lt;/h:inputText&gt; &lt;h:outputText value="Last Name:"&gt;&lt;/h:outputText&gt; &lt;h:inputText value="#{adminManagedBean.editUser.lastName}"&gt;&lt;/h:inputText&gt; THIS BUTTON DOESN'T WORK----&gt;&lt;h:commandButton value="Save Changes" action="#{adminManagedBean.saveNameChange()}"&gt;&lt;/h:commandButton&gt; &lt;h:commandButton value="Cancel Changes"&gt;&lt;/h:commandButton&gt; &lt;/h:panelGrid&gt; &lt;/p:tab&gt; </code></pre> <p>The command button with the value "Save Changes" is the button in question since the bean method is never called.</p> <pre><code>@ManagedBean @ViewScoped public class AdminManagedBean implements Serializable { public String saveNameChange(){ log.info("save Name called"); this.editUser = ssb.updateUser(editUser); return "edituser"; } </code></pre> <p>The method "saveNameChange" is not being called when the button is clicked. Any help wouldbe greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    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. 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