File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create UIComponent by java code

 
liliane fahmy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Please I want to know how to create UIcomponent on the JSF page by java code.

I tried to use addComponentResource invoked from action method,but it didn't work anymore ,here you are the code:


and from the jsf page


There is something wrong or i must do it by another way?
Please help me.

Thanks and best regards
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17641
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's usually best not to create UIComponents in Java code. As I've said many times, the more JSF-specific your code is, the more likely you're doing it wrong. JSF was designed to work as much as possible with generic POJOs.

When it cannot be avoided, however, you need to do it properly. You can't set a component's model value with the UIComponent "setValue" method. The setValue method is what's used to handle the "value=" attribute on a static View Definition, and that particular attribute takes an EL expression, not a simple property value. So setValue() needs an EL expression plus the EL execution context that handles it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic