Typo. :)

Thanks.

Gregg

On 6/30/06, Conway. Fintan (IT Solutions) <[EMAIL PROTECTED]> wrote:
Hi Greg,
 
Just to be pedantic :
 int counter = 0;
for (Market m : marketList) {
        marketArray[counter] = m.getMarketCode();
}

counter is not being incremented in the for loop.  Is this a typo? An undocumented feature of new for .. in loop? a small bug?
 
Just checking,
 
Fintan
 
-----Original Message-----
From: Gregg Bolinger [mailto:[EMAIL PROTECTED]]
Sent: 29 June 2006 21:59
To: MyFaces Discussion
Subject: selectManyCheckbox and pre-selected values

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.


* ** *** ** * ** *** ** * ** *** ** *
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed.
Any views or opinions presented are solely those of the author, and do not necessarily represent those of ESB.
If you have received this email in error please notify the sender.

Although ESB scans e-mail and attachments for viruses, it does not guarantee
that either are virus-free and accepts no liability for any damage sustained
as a result of viruses.

* ** *** ** * ** *** ** * ** *** ** *

Reply via email to