0

I am trying to add a button using primefaces to a JFS page, and upon clicking it a method from a Java class should be called:

<p:commandButton type="submit" 
                 value="Test - Print Message" 
                 action="#{DataForm.Preference}" />

I get the primefaces button (the nice GUI), but when I click on the button the code from the java class DataForm.Preference is not executed.

I have used the attribute action in my code, and I don't think primefaces recognizes it, how should I call the method Preference from my DataForm class?

stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268
Illep
  • 16,375
  • 46
  • 171
  • 302
  • 1
    Already answered in here: http://stackoverflow.com/questions/4639205/primefaces-commandbutton-doesnt-navigate-or-update – Yasin Bahtiyar Aug 04 '11 at 12:16
  • I don't understand how to apply it to my problem as it's discussing about page redirect and my problem is about calling a `java` method from the backend.. – Illep Aug 04 '11 at 16:01
  • Please edit your question and provide more of the code from your page. Also, provide the complete source code for your `Preference` action method. By the way, Yasin is correct. If you read the answer to the question that he linked to carefully you will be able to solve this yourself. – Jim Tough Aug 05 '11 at 00:12

1 Answers1

0

I don't think "preference" is your method Name. Seems like its a property. Why is your value static? What's the point of then using an action method?

Bytekoder
  • 192
  • 1
  • 7
  • 23
  • The `value` will be the name of the button, and `action` will execute the corresponding java method. – Illep Aug 08 '11 at 22:43