• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Binding components and setting ValueExpression

 
Ranch Hand
Posts: 109
1
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day! I'll start by saying that this post is a followup to this one. It has the working code, so I won't litter this thread by repeating it. But to briefly explain what I want to do I'll say this; dynamically create tabs by pressing a button, each tab has Primefaces input texts in which i'll be adding stuff and with a Submit button i'm submitting the form.

My issue now is this; although I can create more buttons through my managed bean, I cannot set the ValueExpression to the InputTexts. When I do:
it doesn't work.

The createValueExpression is a static method in my managed bean and it returns a ValueExpression. I'm most certain I found it online, not sure where though, it's been over a month since the last time I worked with this topic.

Anyway, is my whole "methodology" correct? Should I do anything differently? Can you see any errors in my way of doing?
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, my number 1 rule for JSF is that the more JSF-specific your solution is, the more likely it's not a good one. Although if you're dynamically creating elements, you may need to do it that way.

What I suspect is the problem is that you think that simply setting the value expression is sufficient. It isn't. Setting the value expression creates a binding between a UI element and a backing bean property, but it does not update the display. You'd also have to initiate rendering of the display element.
 
Vasilis Souvatzis
Ranch Hand
Posts: 109
1
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Tim, sorry for the late response.

Tim Holloway wrote:Well, my number 1 rule for JSF is that the more JSF-specific your solution is, the more likely it's not a good one.


Could you elaborate on this one with a generic example? I'm really intrigued now and it seems like a solid advice.

Tim Holloway wrote:What I suspect is the problem is that you think that simply setting the value expression is sufficient. It isn't. Setting the value expression creates a binding between a UI element and a backing bean property, but it does not update the display. You'd also have to initiate rendering of the display element.


Oh my god, is it really that simple... I'm not on my laptop now, will check later and report back.
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This forum is littered with all sorts of atrocities committed by people who felt that JSF should be more complicated than it is.

Well, actually, JSF is pretty complicated, but a lot of that complexity is there to ensure that what the developer has to code won't have to be complicated.

Just search the forum for "Rule #1" and I think you'll see what I mean.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic