posts - 17,  comments - 6,  trackbacks - 0
< netui-data:repeater  dataSource ="{pageFlow.customerList}" >

    
< netui-data:repeaterHeader >< table  cellpadding ="4"  border ="1"

        class
="tablebody"   ></ netui-data:repeaterHeader >

    
< netui-data:repeaterItem >

        
< netui-data:choiceMethod  object ="{pageFlow}"

              method
="getRollerState" >

            
< netui-data:methodParameter  value ="{container.item[1]}" />

        
</ netui-data:choiceMethod >

        
< netui-data:choice  value ="low" >

            
< tr  bgcolor ='#00FF00' >

                
< td >< netui:label  value ="{container.item[0]}" >

                      
</ netui:label ></ td >

                
< td >< netui:label  value ="{container.item[1]}" >

                      
</ netui:label ></ td >

            
</ tr >

        
</ netui-data:choice >

        
< netui-data:choice  value ="high" >

             
< tr  bgcolor ='#FF0000' >

                
< td >< netui:label  value ="{container.item[0]}" >

                      
</ netui:label ></ td >

                
< td >< netui:label  value ="{container.item[1]}" >

                      
</ netui:label ></ td >

            
</ tr >

        
</ netui-data:choice >

    
</ netui-data:repeaterItem >

    
< netui-data:repeaterFooter ></ table ></ netui-data:repeaterFooter >

</ netui-data:repeater >


The 
< netui-data:choiceMethod >  tag specifies the Java method that calculates the data value. The method is determined by setting the tag's object and method attributes. The object attribute specifies the data binding context (the available options are discussed in Chapter 4 in the section "Data Binding with Page Flow"). In this case, the container data binding context refers to the data record in the current iteration. Data is passed into the Java method via a number of nested  < netui-data:methodParameter >  tags, one for each parameter of the Java method. Listing 7.4 shows the getRollerState() method in the Controller.jpf file used in the Casino example. The method simply returns a value of high if the number of purchased chips is greater than 1,000; otherwise, it returns low.

Listing 7.4. Excerpt from Controller.jpf Showing the Business Logic Used to Color-Code Customers

public String getRollerState(String chipsPurchased)

{

    int chips = Integer.parseInt(chipsPurchased);

    if (chips > 1000)

        return "high";

    else

        return "low";

}


 
posted on 2006-06-16 11:17 风中的舞者 阅读(175) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
<2025年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

常用链接

留言簿(1)

随笔档案

文章档案

java技术

搜索

  •  

最新评论

阅读排行榜

评论排行榜