ManagedBean method gets called only second click

UI Components for JSF
Post Reply
ttecsa
Posts: 15
Joined: 17 Feb 2016, 19:37

11 Feb 2019, 18:55

Hi,

I have a simple XHTML page with a command button calling mananged bean action , the action gets called only on second click. Can someone help ?

Primefaces :6.2.11
WebSphere Portal v9
Websphere Application server 9.0.0.9

<p:commandButton value="Register" ajax="false"
action="#{pc_LoginBean.doSelfRegister()}"
styleClass="ui-button-primary" />
@ManagedBean(name = "pc_LoginBean")
@RequestScoped
public class LoginBean
{
public String doSelfRegister()
{
System.out.println("bean action called");
return "success";
}
}

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

11 Feb 2019, 22:20

Tried replacing the p:commandButton with an h: one? (since you don't have ajax). Does that work?
And if you don't have an h:form, behaviour is sort of not very well defined.


Please try https://www.google.com/search?client=fi ... +click+jsf

ttecsa
Posts: 15
Joined: 17 Feb 2016, 19:37

12 Feb 2019, 04:29

Thanks for your reply.

I have same problem with h;commandbutton , not sure how to debug this, could you please advise ?

<div xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">

<h:form>

<p:messages id="messages" showDetail="true" closable="true">
<p:autoUpdate />
</p:messages>
<div class="ui-fluid">
<div class="ui-g">
<div class="ui-g-12">


<p:panelGrid columns="1" cellpadding="2" cellspacing="2"
styleClass="borderlessGrid fullwidth gridzeroleftpadding"
layout="grid" columnClasses="gridzeroleftpadding">


<p:commandButton value="Register" ajax="false"
action="#{pc_LoginBean.doSelfRegister()}"
styleClass="ui-button-primary" />

<h:commandButton value="Register1" ajax="false"
action="#{pc_LoginBean.doSelfRegister()}" />

</p:panelGrid>


</div>
</div>
</div>

</h:form>


</div>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

12 Feb 2019, 11:35

If the same happens with an h:commandButton and (mostlikely) the same happens when you don't use a PrimeFaces panelgrid or any PrimeFaces other component, this most likely is a question for StackOverflow and not for this forum. Please make sure then you have a real 'mcve' https://stackoverflow.com/help/mcve then.

ttecsa
Posts: 15
Joined: 17 Feb 2016, 19:37

12 Feb 2019, 22:42

For now I used below, so it calls some dummy method on load

<p:remoteCommand name="onload" action="#{pc_LoginBean.onLoadRemote}" autoRun="true" />

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

14 Feb 2019, 17:34

Totally unclear what problem this should solve.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests