• 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

how to bind value attribute inside another component binding attribute

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have HtmlPanelGroup which is created using binding attribute. This PanelGroup has many JSF elements like inputText, SelectOneMenu etc.. I am generating the Panelgroup successfully with all the elements.
My question is can I bind a dataObject to the value attribute for the elements under the PanelGroup. If so how will I do this.

For Ex: I am creating a text field inside the panelGroup as follows
HtmlPanelGroup panelGroup = new HtmlPanelGroup();

HtmlInputText inputText = new HtmlInputText();
inputText.setId("someIdVal");
inputText.setValue("someValue");

panelGroup.getChildren().add(inputText )

I am trying to do something like this
HtmlInputText inputText = new HtmlInputText();
inputText.setId("someIdVal");
inputText.setValue("#{someBeanObj.variableName}");

so that when user enters some value in inputTextField , the value gets stored under the mentioned variable.

my xhtml has the following line of code

<ice:panelGroup binding="#{someBean.panelGroup}" />

Any help is appreciated,
Thank you in advance
 
Saloon Keeper
Posts: 27752
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
You can do this, but you have to bind an EL context to the dynamically-created HtmlInputText value property. It won't just take an EL expression, unfortunately.

I've done this, and it's a real pain. I use this method to help me out:


Usage is as follows:


"g0" is the container control for my dynamic fields. In your case, it would be the PanelGroup.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic