Dynamic checkboxes in JSF !!!!!!!

Dear friends,

I have problem about creating Dynamic checkbox from DataBase in JSF.

I use this tag of JSF : <h:selectBooleanCheckbox..... />

I didn't know the property of my managebean?

Please put some codes with managebean for me.(JSP (create checkbox ) & Managebean for this JSF)

I can do this in struts but in JSF i can't.

Please help me to solve my problem.

Thanks,

Farzad

Message was edited by:

Farzad919

[488 byte] By [Farzad919a] at [2007-10-3 1:07:19]
# 1

If I understood your question correctly, you want to display dynamic check box from data of db? Right?

If yes, then I store selectItem object in ArrayList and then relate Managed bean's property to selectmenu . It will display dynamic select Menu. Similarly, you can do it with checkbox. Just need to search which JSF component you need to use.

I hope this will helpful to you.

pratik_milwaukeea at 2007-7-14 18:04:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Yes, first thanks for your answers.

You understood my question exactly.

I want to do this but i have problem in jsf with creating dynamic checkbox.

I can't Set my ArrayList in managebean. The exception is like this:

javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.FacesException: Can't set managed bean property: 'array'.

This is my managebean :

public final class shop extends Object

{

private ArrayList array;

public String[] getArray() {

return array;

}

public void setArray(String[] array) {// This is setter for my property (array)

this.array = array;

}

}

How can i solve this problem?

If it is possible please post some code here. (With manage bean)

Thanks,

Farzad

Farzad919a at 2007-7-14 18:04:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You have to put SelectItem() objects in a List and return it to the f:selectItems nested in a h:selectManyCheckbox.Check this http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSFPage5.html#wp119334
BalusCa at 2007-7-14 18:04:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
You can also use EasySI instead of f:selectitems to easily bind list or map to selectmany component.. http://jsf-comp.sourceforge.net/components/easysi/index.html
mulderbabaa at 2007-7-14 18:04:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Dear friends,Thanks for answers , the link is useful for me to solve this problem.Farzad
Farzad919a at 2007-7-14 18:04:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...