こんにちは、シリアル番号を持つ列でデータ可能なデータを作成したいのですが、ボタンのクリックで行を追加してデータ列を動的にしています。シリアル番号を生成する必要があります。このシナリオで何をチャットしますか?
私のjsfページ
<rich:dataTable value="#{section2Bean.employeeList}"
var="emp" style="width:100%;">
<h:column>
<f:facet name="header">
#{msg.lbl_serialNo}
</f:facet>
<h:outputText value="#{TnwrdBean.hrmsBean.hrmsSection9.serialNo}" />
</h:column>
<h:column>
<f:facet name="header">
#{msg.lbl_addRow}
</f:facet>
<div class="buttons">
<p align="center">
<h:commandButton id="addEduQualRow" type="submit" actionListener="#{section2Bean.addNewEmployee}"
value="+" />
</p>
</div>
</h:column>
</rich:dataTable>
Section2Bean.java
public class Section2Bean extends BaseAction implements Serializable {
private static final long serialVersionUID = 32423545435345L;
List<Employee> employeeList;
List<Employee> employeetrainingList;
private boolean checkSelected;
public List<Employee> getEmployeeList() {
return employeeList;
}
public void setEmployeeList(List<Employee> employeeList) {
this.employeeList = employeeList;
}
public void addNewEmployee(ActionEvent event) {
employeeList.add(new Employee(employeeList.size(), null));
System.out.println(employeeList);
for(int i = 1;i<=employeeList.size();i++){
}
}
public void deleteNewEmployee(ActionEvent event){
employeeList.remove(employeeList.hashCode());
}
@PostConstruct
public void init() {
employeeList = new ArrayList<Employee>();
employeetrainingList =new ArrayList<Employee>();
employeeList.add(new Employee(1, ""));
}
public Section2Bean() {
}
public boolean isCheckSelected() {
return checkSelected;
}
public void setCheckSelected(boolean checkSelected) {
this.checkSelected = checkSelected;
}
}