Pu:menu loads 4 times every time

Post Reply
jfgomez
Posts: 19
Joined: 14 Jun 2016, 06:15

29 Aug 2020, 20:07

Hello

I have an issue. I'm using ultima 2.1.1 and my source is this:
The ask is: why pu:menu loads 4 times every refresh?


ing menu.xhtml call menu.model

Code: Select all

	<pu:menu widgetVar="me" model="#{menu.model}" id="me" />
in menuController the method getModel is:

Code: Select all

...
	private MenuModel modelo;
...
public void createMenu() {
        this.model = new DefaultMenuModel();
        ....
}        
...
public MenuModel getModel() {

        long startTime = System.nanoTime();
        if (this.model == null || this.modelo.getElements().isEmpty()) {
            createMenu();
        }

        long endTime = System.nanoTime() - startTime; // tiempo en que se ejecuta el método
        LOGGER.log(Level.SEVERE, "{0} ({1}): MenuController.getModelo() {2} Milisegundos", new Object[]{util.getCURRENT_OPERATOR().getOperador(), util.getCURRENT_OPERATOR().getId(), endTime});
        return this.model;
    }
And it works... but 4 times every do I change xhtml

my standar output is:

Code: Select all

  jfgomez (2): MenuController.getModel() 635.815.184 Milisegundos|#]
  jfgomez (2): MenuController.getModel() 14.702 Milisegundos|#]
  jfgomez (2): MenuController.getModel() 815 Milisegundos|#]
  jfgomez (2): MenuController.getModel() 783 Milisegundos|#]
...
 (other xhtml)
...
  jfgomez (2): MenuController.getModel() 463.463.154 Milisegundos|#]
  jfgomez (2): MenuController.getModel() 9.734 Milisegundos|#]
  jfgomez (2): MenuController.getModel() 1.023 Milisegundos|#]
  jfgomez (2): MenuController.getModel() 1.102 Milisegundos|#] 
It takes some seconds to refresh.

The ask is: why pu:menu loads 4 times every refresh?

jfgomez
Posts: 19
Joined: 14 Jun 2016, 06:15

03 Sep 2020, 00:55

Hello, @aragorn,

Please, could you gime some direction to solve this problem :idea: ..... thanks for your cooperation

Best regards,

Juan Fernando.

mert.sincan
Posts: 4318
Joined: 29 Jun 2013, 12:38

12 Sep 2020, 14:20

Hi @jfgomez,

This is related to JSF cycle;
https://stackoverflow.com/questions/209 ... iple-times

Best Regards,

jfgomez
Posts: 19
Joined: 14 Jun 2016, 06:15

12 Sep 2020, 17:08

Thanks @aragorn,

Ok, it is understood

mert.sincan
Posts: 4318
Joined: 29 Jun 2013, 12:38

12 Sep 2020, 22:03

You're welcome! Thanks a lot for the update!

Best Regards,

Post Reply

Return to “Ultima - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests