Problem with h:form and p:ajax (Mojarra 2.0.2 and Primefaces 2.0.2)

前端 未结 1 1179
轮回少年
轮回少年 2021-01-25 06:31

I have got this site:



&l         


        
1条回答
  •  生来不讨喜
    2021-01-25 06:36

    This can have two causes:

    1. The Primefaces resource servlet is not properly configured which will cause that the necessary JavaScripts won't be loaded. You should be able to see it by checking the JS error console in your webbrowser for any JS errors when focusing the input. In Firefox, the console is available by pressing Ctrl+Shift+J.

      The resource servlet will be loaded automatically in Servlet 3.0 environments (Glassfish v3, Tomcat 7, JBoss 6, etc), however in older environments, you need to configure it manually in web.xml:

      
          PrimeFaces Resource Servlet
          org.primefaces.resource.ResourceServlet
      
      
          PrimeFaces Resource Servlet
          /primefaces_resource/*
      
      
    2. The method signature is wrong. You should be able to see it by reading the server logs and seeing a javax.el.MethodNotFoundException in the logs. The code example in your question is correct, but there's ambiguity in ActionEvent. There's a class with the same name in java.awt.event package. You might have accidently (auto-)imported it. Verify if it is indeed javax.faces.event.ActionEvent and not something else.

    If none helps, you may want to consider to replace the PrimeFaces p:ajax by the standard JSF 2.0 f:ajax:

    
    

    with

    public void startCopyingWarFile(AjaxBehaviorEvent event) {
        // ...
    }
    

    where AjaxBehaviorEvent is javax.faces.event.AjaxBehaviorEvent.

    0 讨论(0)
提交回复
热议问题