Menubar using ValueExpression

UI Components for JSF
Post Reply
Cesar Pizolato
Posts: 3
Joined: 31 Oct 2010, 16:43

11 May 2011, 22:08

Hi, i'm trying to create a dinamically primefaces menubar, but, i got a problem.
I need to use ValueExpression in property Value or ValueExpression (I'm not sure what's the correct option to use) to do this:

#{LanguageBean.getText('TXT_EXAMPLE')}

The return of this expression will be my Value, but, when i started the application, the value of MenuItem stay null, then, nothing is displayed.

Someone here know what i have to do? I'm having a headache with this problem.

Sorry for my bad english guys.

Thanks for you help.

porthos
Posts: 122
Joined: 09 May 2011, 03:17

11 May 2011, 23:52

Not enough info about the context in which you're doing this. Where is the element in the page?

What happens if you put a debug point in your LanguageBean's getText() method and then open the page, is it called?
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

Cesar Pizolato
Posts: 3
Joined: 31 Oct 2010, 16:43

12 May 2011, 00:41

The problem is not in getText(), if i create the <p:menubar /> manually, it works perfectly.

My problem is here:

Code: Select all

ValueExpression value = FacesContext
					.getCurrentInstance()
					.getApplication()
					.getExpressionFactory()
					.createValueExpression(
							FacesContext.getCurrentInstance().getELContext(),
							"#{IdiomaController.getTexto('TXT_PORFAVOR')}",
							Object.class);
			mi.setValueExpression("value", value);
			//mi.setValue(value);
The ValueExpression doesn't work, if i replace #{IdiomaController.getTexto('TXT_PORFAVOR')} for "anyone string", doesn't works too. The problem is in ValueExpression, but i don't know how to fix it.

I have tested replace Object.class for String.class, but still doesn't work.

Cesar Pizolato
Posts: 3
Joined: 31 Oct 2010, 16:43

12 May 2011, 04:45

help?

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

12 May 2011, 11:20

Hi,

Are you sure your beans are configured with first upper case letters LanguageBean / IdiomaController?
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests