File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes javax.faces.el.MethodNotFoundException in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "javax.faces.el.MethodNotFoundException in JSF" Watch "javax.faces.el.MethodNotFoundException in JSF" New topic
Author

javax.faces.el.MethodNotFoundException in JSF

Padma Priya
Ranch Hand

Joined: Feb 01, 2007
Posts: 113
Hi all,


I have 2 text fields and one select drop down. The logic is that if i change the value in one text box the value in the other text box needs to be changed automatically based on a logic implemented in a method in the controller and vice versa.

Code for Percentage text field



Code for Amount text field




Code for the dropdown




So for all three of the above fields. When some actions are carried on these fields like changing the value in the text boxes and selecting a value from the drop down the onchange calls the submitOnXXXChange() javascript methods.



There are Fake buttons coded which in turn call the methods that are coded in the controller. These methods hold the logic for what ever needs to be done when the values in the 2 text fields and the value in the dropdown changes.


On Amount change



On Percentage change



On Status Change

.

The problem i am facing is when i change the percentage /Amount fileds everything is working fine. The appropriate onSettelmentAmtChange() and
onSettelmentPercentageChange() methods in the controller are called properly. But when i try to select a list from the drop down i get the below error.




Can anyone help me out in figuring why this happening. I know its not the best coding practice but the code was put as a workaround or something and nobody wants to touch it.

Thanks in advance for your help.


With Regards,
Padma Priya

Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1027
Well lets take a look at what is different between these methods shall we?

public void onSettelmentAmtChange() throws AbortProcessingException {
public void onSettelmentPercentageChange() throws AbortProcessingException {
public void onSettelmentStatusChange(ValueChangeEvent event)

Hmmm. Thats different.
Your statusChange method takes a ValueChangeEvent parameter, where your other ones don't...
And the error message complains:
Cannot find method: com.wellsfargo.yom.account.controller.RecoveryController.onSettelmentStatusChange()
Well thats true, because a method which takes no parameters isn't there.

So why does this one take a parameter? What is this parameter meant to do? and where does its value come from?
A quick google later, and an answer is forthcoming.

That method declaring a ValueChangeEvent parameter is meant to be invoked by faces directly using a onValueChange attribute of your dropdown.
You are manually trying to call this method via your onchange javascript event.
So if you are not going to use the JSF event for it, don't use the ValueChangeEvent object.

My suggestion: use JSF as it was meant to be used, with a valueChangeEvent on the selectOneListBox, instead of fudging it with javascript onchange events.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.faces.el.MethodNotFoundException in JSF