Thanks.
On 6/29/06,
Gregg Bolinger <[EMAIL PROTECTED]> wrote:
I have written some code that I am waiting for some of the DAO stuff to get finished before I can test it. So thought I'd go ahead and ping this list and see if what I am trying to do might actually work.
I have an Article. Each article contains a List<Market>. When I view the Article details for review/modify/aprove, etc, I display a group of checkboxes for the Markets using t:selectManyCheckbox. But what I need is for the markets to be checked that are in the List<Market>. So I have the following method:
public String[] getMarkets()
{
String[] marketArray = {};
List<Market> marketList = currentArticle.getMarketList();
if (marketList != null)
{
marketArray = new String[ marketList.size()];
int counter = 0;
for (Market m : marketList)
{
marketArray[counter] = m.getMarketCode();
}
}
return marketArray;
}
public List<SelectItem> getMarketList()
{
List<SelectItem> list = new ArrayList<SelectItem>();
List<Market> marketList = articleService.getMarkets();
for (Market m : marketList)
{
list.add(new SelectItem(m.getMarketCode(), m.getMarketName()));
}
return list;
}
<t:selectManyCheckbox layoutWidth="2" value="#{ ModifyArticleBean.markets}" layout="lineDirection">
<f:selectItems value="#{ModifyArticleBean.marketList}"/>
</t:selectManyCheckbox>
So does this look correct? If not, what would need to be changed?
Thanks.