0

UPDATE
After comments, I tried to reduce the example code to a minimal part, and (thanks to Balush) I discovered that is not related to the inheritance, neither to jpa or eclipse link. A simple page with two button and one controller that have just one field: the first time I push one button, it does not reload the page and execute the listener, the second time reload the page and the listener is never called Follow the two part of code

partdetails.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title></title>
    </h:head>
    <h:body>

        <h:form id="form">
            <div class="border">
                    <h:outputText value="#{partDetailsController.editing}" />
            </div>
            <h:panelGrid columns="2">
                <f:facet name="footer">
                    <br />
                    <p:commandButton id="btnEditCancel" value="Cancel" update=":form" actionListener="#{partDetailsController.onBtnEditCancelClick}" 
                                      immediate="true" />
                    <p:commandButton id="btnEdit" value="Edit" update=":form" actionListener="#{partDetailsController.onBtnEditClick}" 
                                     style="margin-right: 0.9em;" />
                </f:facet>
            </h:panelGrid>
        </h:form>
    </h:body>
</html>

and the controller (partDetailsController.java)

package test.controllers.views;

import java.io.Serializable;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ActionEvent;

@ManagedBean
@ViewScoped
//public class PartDetailsController extends PartBaseController implements Serializable
public class PartDetailsController  implements Serializable
{

    private static final long serialVersionUID = 6704867527770742213L;

    private boolean editing = false;
    private static final Logger LOG = Logger.getLogger(PartDetailsController.class.getName());

    /**
     * Costruttore della classe.
     */
    public PartDetailsController()
    {
       LOG.info("constructor");

    }

    @PostConstruct
    public void init()
    {
        LOG.info("init");

    }

    public boolean isEditing()
    {
        return editing;
    }

    public void setEditing(boolean editing)
    {
        this.editing = editing;
    }

    public void onBtnEditClick(ActionEvent event)
    {
        LOG.info("edit pushed, editing value was "+ isEditing());
        editing = true;
    }

    public void onBtnEditCancelClick(ActionEvent event)
    {
        LOG.info("cancel pushed, editing value was "+ isEditing());
        editing = false;
    }

}

The application have an authentication, in web.xml

    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>ourSecurity</realm-name>
        <form-login-config>
            <form-login-page>/login.xhtml</form-login-page>
            <form-error-page>/permissiondenied.xhtml</form-error-page>
        </form-login-config>
    </login-config>

To describe the behavior using the log printed:
Load the page -> into the log "constructor", "init" (as expected)
Click Edit -> into the log "edit pushed, editing value was false" (as expected)
Click Edit Again -> into the log "constructor", "init" (expected "edit pushed, editing value was true")
From this point on, the listener is never called again, until you reload the page into the browser

Do you have any clue where to investigate?

thank you


UPDATE 2 The application is build with primefaces 3.5


UPDATE 3

we use JSF 2.2

We tested it on a glassfish3.1.2 environment and on a Payara5 too

user2946593
  • 63
  • 2
  • 11
  • 1
    And none of these causes apply? https://stackoverflow.com/q/5541813 – BalusC Oct 04 '19 at 16:28
  • I've read this post and already checked: 1 - newer version 2: newer version 3: right import 4: no "transient" anywhere 5: we had no problem with "view expired, so we never add that parameter 6: I've checked if we pass a new perimw faces library, and I've found nothing 7: as you can see ni the jsf page, no dialog in page 8: as you can see no upload in the page 9: we use prime faces – user2946593 Oct 05 '19 at 08:29
  • So after checking all this, you immediately started creating a [mcve] which you now have ready to replace the code in your question? And you also have an edit of the question waiting with all the version info? – Kukeltje Oct 06 '19 at 19:57
  • @Kukeltje: is exactly what I did. If you had a look to the code, you will see a bare example. I've recreated a working example reproducing of a lot more complex application. We have tested on glassfish 3.1.2 and on payara5, with more or less the same result If I can help in any way to permit you to replicate the problem, please let us know – user2946593 Oct 07 '19 at 10:19
  • 1
    All due respect, this is *absolutely* not a minimal reproducible example. Because, right now you're basically implying that when you remove `styleClass="insertForm-table"`, then your whole problem is solved. But this is not the case. This means that this specific piece of code `styleClass="insertForm-table"` does totally not contribute to the problem and is thus pure noise and must be removed from the snippet else you're making it difficult for potential answerers to see your real problem. And your snippet really has many more of these pieces .. See also https://stackoverflow.com/tags/jsf/info – BalusC Oct 07 '19 at 11:17
  • @BalusC: You're right, I miss it: I will edit the question – user2946593 Oct 07 '19 at 11:48
  • Hi, Thanks, good [mcve], compliments. 1: it is BalusC, not Balush. 2: please remove all re irrelevant pieces of your question. It makes it &tldr; 3: with the new knowledge, did you check the link in his first comment again? 4: Did you try updating less than the form? 5: Did you check the browser developer console? 6: What is your JSF implementation and version? 7: Did you try a newer PrimeFaces version? – Kukeltje Oct 07 '19 at 19:30
  • Jsf 2.2 is not an implementation and a real version. It is an api spec, e.g. see #2 in the link in the first comment by BalusC – Kukeltje Oct 08 '19 at 08:39
  • Oh and did you try without the authentication? Or any filters? – Kukeltje Oct 08 '19 at 08:45
  • @Kukeltje: I will try without auth, just to identify if is depending on it – user2946593 Oct 08 '19 at 09:23
  • @BalusC: change to a newer version of primefaces needs a lot of work, due to the changes of the api. I'm right now evaluating the effort generated by the impact of the new Library – user2946593 Oct 08 '19 at 09:25
  • @Kukeltje: For the implementation, if you are talking about Mojarra, is Mojarra 2.3.9.payara-p2 – user2946593 Oct 08 '19 at 09:30
  • So, when you remove `
    `, your problem is solved? And when you remove `
    `, your problem is solved? And when you remove `style="margin-right: 0.9em;"` your problem is solved? Sorry, I find it a bit hard to believe. Then why did you still include this noise in the question? (there is more in your XHTML btw). But you have there a `` with apparently a custom realm. When you remove it, is your problem solved? If so, then the cause of your problem would be there. If not, then you should remove it from the question because it does not at all cause your problem.
    – BalusC Oct 08 '19 at 10:13
  • And (althought I don't think it is related) try with the JSF 2.2+ namespaces. (and for just this issue, using PrimeFaces 6.3 or 7.0 should not be a problem) – Kukeltje Oct 08 '19 at 11:23
  • As IDE we use NetBeans. We tried to compile the same project with an older version of NetBeans (8.2), and PrimeFaces start working again. Having all the libraries added to the project exactly the same, where could be the difference? Have you any hint? – user2946593 Oct 15 '19 at 12:14

0 Answers0