0

I'm deploying my little website on glassfish and I have a 2 method what runs a python file. Methon one is just runs the python file nothing more. When I access to a site it automatically call all the functions...

public void reservate() {
        System.out.println("ALMAAA");
        String start, end;
        start = time1.substring(0,5);
        end = time1.substring(6,11);
        reserv = new Reservation("ASD", room, "19.00", "20.00");
        reserv.getOutput();
    }



<p:commandLink value="#{navigationTo.time1button}" onclick="#{navigationTo.reservate()}" style="font-size: 300%"/>

The reserv.getOutput() triggers the file and runs the python file. If I just access to this site even if i dont click on this actionlink it triggers everyting and it made the reservation...

I want to only run this python file if I click the commadnLink.

Any suggestion?

  • `onclick` is not the right place to have `#{navigationTo.reservate()}`. What's the purpose of `navigationTo.time1button`? Can't you have the `reservate` function in there? – kolossus Jun 18 '14 at 19:40
  • navigationTo.time1button is returns a string what this link displays but I want to run this reservate method just when I click on it. But now it always runs when you just load this page. Thats my problem. – user3747957 Jun 25 '14 at 08:38
  • I misspoke when I suggested that you move the `{navigationTo.reservate}` into the `value` attribute, but my earlier recommendation holds: `#{navigationTo.reservate()}` should not be in the `onclick` attribute; it should be in the `action` attribute – kolossus Jun 25 '14 at 13:08
  • I just get infomed about how this works and the problem is that primefaces when generates the client side it automatically call all methods to make static site. That's why its called. The only way to do this in pirmefaces when you make it as Commandbutton/link and you give this in ActionListener. Thats the only thing what call after you clicked not before. – user3747957 Jun 27 '14 at 10:40

0 Answers0