Reputation:
I've looked on similar questions and none of the solutions worked.
I'm doing a Ajax call but my method is never called.
I have this error on Chrome:
GET http://localhost:8080/ERP.GUI2/views/user/login.html jquery.js.html:23
b.ajaxTransport.send jquery.js.html:23
b.extend.ajax jquery.js.html:23
PrimeFaces.ajax.Queue.offer primefaces.js.html:1
PrimeFaces.ajax.AjaxRequest primefaces.js.html:1
PrimeFaces.ab primefaces.js.html:1
onclick
I have checked and those files are ok, they exist and the path is correct, I can open them on the browser.
Here is my button:
<p:commandButton actionListener="#{userController.logIn()}" value="Entrar"/>
There are times when the error is just:
Failed to load resource http://localhost:8080/ERP.GUI2/views/user/login.html
When I first run the code, no errors are reported, the error shows exactly when I click the button calling the method.
I don't know if it is important but I'm using Eclipse and it have added a JavaScript Resources
, I don't know if it is interfering in something and don't know how to remove it.
Upvotes: 0
Views: 2076
Reputation: 11608
If you're using JSF ManagedBean annotation or any JSF scope annotation like @RequestScoped
or @SessionScoped
, make sure it imports from javax.faces.bean
package.
Sometimes code completion imports from the wrong package by mistake.
Now, assuming that your logIn()
method is public void
as in:
public void logIn()
{
//login code here
}
you should remove the parenthesis from EL because the actionListener property already expects a method expression.
Try:
<p:commandButton actionListener="#{userController.logIn}" value="Entrar"/>
I hope it helps.
Upvotes: 1