Using <h:selectManyCheckBox>

I have an object with the following properties.

public class LicenseLineDto extends ProducerDto {

private boolean selectedLine;

private String line;

private String lineStartDateString;

private String lineEndDateString;

// Getters and Setters

}

I have a screen which needs to display a table something like this.

<Checkbox>selectedLine牋牋 ?line牋牋lineStartDateString牋牋 lineEndDateString

I will have a list of the above mentioned rows on the screen. Each row in the list corresponds to an object of the class above. the line is a an output textbox, the 2 date strings are input text boxes, and there is a submit button on the screen. The user can check a checkbox enter the corresponding dates, and hit submit, the user can select multiple checkboxes and enter the dates corresponding to each checked checkbox and hit submit.

How do I code this functionality using JSF?

[945 byte] By [J2EELearnerForLifea] at [2007-11-26 16:44:58]
# 1
Use h:dataTable with h:selectBooleanCheckbox.Check http://balusc.xs4all.nl/srv/dev-jep-dat.html how to use datatables.
BalusCa at 2007-7-8 23:12:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]I have tried that

heres the code that I have

<h:dataTable border="0" cellpadding="0" cellspacing="0"

columnClasses="columnClass1" headerClass="columnClass1"

footerClass="footerClass" rowClasses="columnClass1"

styleClass="dataTable" id="innerTable" first="0" binding="#{bean.data}"

value="#{bean.linesList}" rendered="true" var="lines" width="60%">

<h:column>

<h:selectBooleanCheckbox value="#{lines.selectedLine}" />

</h:column>

<h:column>

<f:facet name="header">

<B><h:outputText styleClass="outputText"

value="#{msg['producer.licenseLines']}" />

</f:facet>

<h:outputText styleClass="outputText" value="#{lines.line}"></h:outputText>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText styleClass="outputText"

value="#{msg['producer.licenseStartDate']}" />

</f:facet>

<h:inputText styleClass="inputText" value="#{lines.lineStartDate}" id="lineStartDate">

<f:convertDateTime type="date" pattern="MM-dd-yyyy" />

<hx:inputHelperDatePicker firstDay="0" />

</h:inputText><BR><BR>

<h:message styleClass="message" id="lineStartDateMessage" for="lineStartDate"></h:message>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText styleClass="outputText"

value="#{msg['producer.licenseEndDate']}" />

</f:facet>

<h:inputText styleClass="inputText" value="#{lines.lineEndDate}" id="lineEndDate">

<f:convertDateTime type="date" pattern="MM-dd-yyyy" />

<hx:inputHelperDatePicker firstDay="0" />

</h:inputText><BR><BR>

<h:message styleClass="message" id="lineEndDateMessage" for="lineEndDate"></h:message>

</h:column>

</h:dataTable>

But when the submit button is hit, the linesList is empty.

Thanks[/nobr]

J2EELearnerForLifea at 2007-7-8 23:12:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You're using a request scoped bean? If so, change your data loading logic. Eventually re-read the whole article.
BalusCa at 2007-7-8 23:12:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I have read through the article a couple of times but I am not able to figure out how to do that. Is there another id or something so I can send you some code and maybe some screenshots, so that I can understand what your saying with reference to my requirement.Thank you.
J2EELearnerForLifea at 2007-7-8 23:12:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Download the EAR, read the code and play with it.
BalusCa at 2007-7-8 23:12:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...