• 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

Problem with adding jsf component programmatically|dynamically

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone tell me how can i add jsf component programmatically|dynamically with javax.faces.* api ?
I don't want use jsf taglib in my jsp page to add jsf components.

I need sample codes or some other refrences.

regards
solmaz anvar
[ September 14, 2005: Message edited by: Solmaz Anvar ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Who in their right mind would want to add components under program control when they can use html type scripting??

That's almost as crazy as wanting an easy to use timer.
javascript: x()
Confused
Burf
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is possible to add components dynamically.
Create a container bean like this one:


public class ComplexBean
{

protected UIComponent component;

public ComplexBean()
{
component = new UIPanel();
}

public UIComponent getComponent()
{
return component;
}

public void setComponent(UIComponent component)
{
this.component = component;
}
}



Use component instance binding in your page, for
instance

<h anelGrid binding="#{ComplexBean.component}"/>

(The bean should be configured as a managed bean).

Now if you add components to your
ComplexBean.getComponent(), they will appear on the
page. You can add the dynamically/programmatically.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ichabod Grabarkowitz:
Who in their right mind would want to add components under program control when they can use html type scripting??

That's almost as crazy as wanting an easy to use timer.
javascript: x()
Confused
Burf



There are people that prefer that dynamic Java mechanism over the stupid craze of DHTML and the stupidity of Javascript based stuff...

Let's cool down:
There are places and reasons where JS is forbidden:
- security-conscious companies (-> the TSS-thread about the hero, which describes a AJAX-hack; or cross-scripting)
- Government contracts (USA, Germany, most probably also others) where the accessability laws do not allow those dynamic things, because handicapped users might have problems...

There is a time and place for both variants of doing dynamic stuff.

regards
Alexander
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Solmaz:

I like where you're going with this solution, but I'm confused about how to do this part:

Originally posted by Solmaz Anvar:
Now if you add components to your
ComplexBean.getComponent(), they will appear on the
page. You can add the dynamically/programmatically.



What I'm not sure how to do is "add components to your ComplexBean.getComponent()" - could you provide a little more information (or link to more information) regarding how to do this?

Thanks!

--- EDIT ---
OK - I think I may have found what I needed. Were you suggesting something like this:



Thanks Again!
[ November 29, 2006: Message edited by: evan stone ]
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic