1. Открываем EO VO на основе таблицы с большим количеством записей
2. В EO добавляем атрибут Attr (Transient, boolean, NUMBER, editable allways)
3. Добавляем Attr в VO
4. Создаем session bean StateHolderBean.java
public class StateHolderBean {
private MyCheckBoxHolder valholder = new MyCheckBoxHolder();
public void setValholder(StateHolderBean.MyCheckBoxHolder valholder) {
this.valholder = valholder;
}
public StateHolderBean.MyCheckBoxHolder getValholder() {
return valholder;
}
public StateHolderBean() {
super();
}
private class MyCheckBoxHolder extends HashMap<Object, Boolean> {
@Override
public Boolean get(Object key) {
//System.out.println("getting key "+key+" val "+super.get(key));
if (!this.containsKey(key) && this.containsKey("allselect")) {
return super.get("allselect");
}
if (super.get(key) == null) {
return false;
}
return super.get(key);
}
@Override
public Boolean put(Object key, Boolean b) {
System.out.println("Putting key: " + key + " val " + b);
if (b != null && key != null) {
return super.put(key, b);
} else {
return super.put(key, false);
}
}
}
}
5. Создаем форму untitlead1.jspx с таблицей
6. Создаем view bean untitlead1B.java
7. Байндим таблицу t1 на t1 в untitlead1B
#{viewScope.untitlead1B.t1}
8. В форме у checkbox Attr ставим в Value
value="#{StateHolderBean.valholder[row.bindings.EmployeeId.inputValue]}"
и выставляем autoSubmit="true"
9. process
public String process() {
HashMap checkval = (HashMap) getValueObject("#{InOperationsB.valholder}");
Iterator it = checkval.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
System.out.println(pairs.getKey()+" : "+pairs.getValue());
}
return null;
}
2. В EO добавляем атрибут Attr (Transient, boolean, NUMBER, editable allways)
3. Добавляем Attr в VO
4. Создаем session bean StateHolderBean.java
public class StateHolderBean {
private MyCheckBoxHolder valholder = new MyCheckBoxHolder();
public void setValholder(StateHolderBean.MyCheckBoxHolder valholder) {
this.valholder = valholder;
}
public StateHolderBean.MyCheckBoxHolder getValholder() {
return valholder;
}
public StateHolderBean() {
super();
}
private class MyCheckBoxHolder extends HashMap<Object, Boolean> {
@Override
public Boolean get(Object key) {
//System.out.println("getting key "+key+" val "+super.get(key));
if (!this.containsKey(key) && this.containsKey("allselect")) {
return super.get("allselect");
}
if (super.get(key) == null) {
return false;
}
return super.get(key);
}
@Override
public Boolean put(Object key, Boolean b) {
System.out.println("Putting key: " + key + " val " + b);
if (b != null && key != null) {
return super.put(key, b);
} else {
return super.put(key, false);
}
}
}
}
5. Создаем форму untitlead1.jspx с таблицей
6. Создаем view bean untitlead1B.java
7. Байндим таблицу t1 на t1 в untitlead1B
#{viewScope.untitlead1B.t1}
8. В форме у checkbox Attr ставим в Value
value="#{StateHolderBean.valholder[row.bindings.EmployeeId.inputValue]}"
и выставляем autoSubmit="true"
9. process
public String process() {
HashMap checkval = (HashMap) getValueObject("#{InOperationsB.valholder}");
Iterator it = checkval.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
System.out.println(pairs.getKey()+" : "+pairs.getValue());
}
return null;
}