p:commandButton and h:commandButton

UI Components for JSF
Post Reply
parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

04 May 2011, 17:37

Hi,

There has been many occassion when i see that p:commandButton is not working, but h:commandButton is working..
p:commandButton works, but at times it just does not.
It does not throw any error, but it does not call the backing bean method.. just replace it by h:commandButton and it works.

Any clue why it behaves this way ?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 May 2011, 17:38

Sometimes, Many occasions? You need to be more clear.

kanikman
Posts: 111
Joined: 20 Nov 2009, 02:53
Location: Poland
Contact:

04 May 2011, 18:25

for instance. When you use h:commandButton selection in dataTable not works. Selected row is always empty.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 May 2011, 19:27

No code, no help. ;)

parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

05 May 2011, 14:44

I am sorry for the delay.. I did not get any automated reply, so could not see your replies until now.

My code is as follows. updateUser() never gets called... I tried changing the scope of the backing bean to ViewScope from RequestScope. But that didn't help.
Even if I type a wrong name instead of updateUser(), it does not throw any error.

<h:panelGroup rendered="#{flash.showMoreUserInfo}"
id="showMoreUserInfoID">
<c:set property="showMoreUserInfo" target="#{flash}" value="null"/>

<h:outputText
style="font:Arial; font-size:x-large; font-style:italic; color:grey; "
value="Under Construction !!" />
<br />
<h:panelGrid columns="2" cellpadding="20" cellspacing="100">
<h:panelGrid columns="1" id="grid">
<p:panel header="Account Information"
rendered="#{headerBacking.currentUser.id eq userPageBacking.user.id}">
<h:panelGrid columns="3" cellspacing="10" >
<h:outputText value="Bank Name : " />
<p:inputText id="bankName"
value="#{userPageBacking.user.wudAccountDetail.wadBankname}" />
<h:message for="bankName" showDetail="true" />
<h:outputText value="Account Number : " />
<p:inputText id="accNumber"
value="#{userPageBacking.user.wudAccountDetail.wadAccountNumber}" />
<h:message for="accNumber" showDetail="true" />
<h:outputText value="Account Holder Name : " />
<p:inputText id="holderName"
value="#{userPageBacking.user.wudAccountDetail.wadAccountHolderName}" />
<h:message for="holderName" showDetail="true" />
</h:panelGrid>
</p:panel>
<h:panelGrid columns="2" cellspacing="10">
<p:growl sticky="true" showDetail="false" />
<p:commandButton value="Update"
action="#{userPageBacking.updateUser}"
oncomplete="dlg.show()" />
</h:panelGrid>


</h:panelGrid>



<p:dialog widgetVar="dlg">
<p:panel style="width:300px; height: 200px;">
<h:outputText
value="Details of #{headerBacking.currentUser.wuFirstName} updated." />
</p:panel>
</p:dialog>

</h:panelGrid>

</h:panelGroup>




The first line is a print in updateUser(), but it never gets called.


public String updateUser() {
System.out.println("updateUser outside :" + getUser());
..............

parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

05 May 2011, 16:12

tried with the following options as well, nothing seems to be working...
immediate="true"
process="@this, contentform:showMoreUserInfoID"
<p:commandLink> instead of commandButton
<h:commandButton>

parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

05 May 2011, 16:14

just see this warning in the log file
Unable to set request character encoding to UTF-8 from context /wompower6, because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

rest all are info.

parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

05 May 2011, 16:41

Hi,

I kind of got the problem, but do not know how it can be solved.
basically I have some links in the page, which when clicked populate the account info to be updated. it is like,

<p:commandLink value="More about myself..."
update="contentform:userRightID" style="font-size:small;">
<f:setPropertyActionListener
target="#{flash.showMoreUserInfo}" value="true" />
</p:commandLink>

So when the link is clicked the viewRoot is reset to null and the action does not know whom to associate... can this be the case ?

parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

05 May 2011, 16:46

changed the flash.showMoreUserInfo to viewScope.showMoreUserInfo and that seems to work finally.

parindam
Posts: 23
Joined: 23 Dec 2010, 12:47

05 May 2011, 19:17

<p:commandButton> does not work inside <ui:repeat>, but <h:commandButton> works.
Is this an expected behavior ?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests