This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Add component on a button click

 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been trying to add componenets checkbox and an input text box since last week. I was using selectmany check box ,that didn't work out. Now when I went through the forum, I found that I can use selectBooleanCheckbox for dynamically adding. Now, when I press the button for the first time I got a checkbox and an input text. But when I press the button second time, nothing happens instead of adding one more checkbox and input text.

I am confused now. I am putting my code here, please anyone direct me from here ?

jsp:


bean:


More clearly, if I press the Add button two time, I need to get 2 checkboxes and input boxes.
Bauke gave me initial idea, but still am confused.
Please help me.

Thanks,
Joe.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have suggested you to use DTO's instead.
http://www.coderanch.com/t/212251/JSF/java/selectManyCheckbox
Check my posting there at October 11, 2006 08:44 AM.
 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have tried with DTO. But the added values doesn't diplay in datatable.

What I am trying to do is, enter value through input text and display it in a datatable.

Here is my code :

jsp:
<h:commandButton id="addAdhocs" action="#{CreateQuoteBean.addAdhocs}"
value="Add" styleClass="focusButton" />

<h:dataTable value="#{CreateQuoteBean.taskDataList}">
<h:column>
<hutputText id ="tk" value="#{TaskSelected.taskData}" />
<h:message for="tk"/>
</h:column>
<h:column>
<hutputText id="td" value="#{TaskSelected.taskQt}" />
</h:column>
</h:dataTable> [/CODE]

bean:



I don't understand why the values not setting in output text. Please help me.

Thanks,
Joe.
 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. I hadn't given var attribute in datatable tag.

Thank you very much Bauke.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic