Why selectOneMenu Send ItemLabel to the converter?

前端 未结 4 2148
孤独总比滥情好
孤独总比滥情好 2020-12-01 17:20

my JSF page



                      
     

        
4条回答
  •  一生所求
    2020-12-01 17:34

    Today I had the same problem.

    It is caused by this wrong rendering:

    
    

    omitting value="" for "None" option result in submitting the label instead of an empty string.

    However to solve this and make the renderer write value="" for the first option just make sure getAsString() never returns null, return "" (empty string) instead.


    @BalusC

    
        ...
    
        
            
            
        
    
        
            
        
    
        
    
        ...
    
    
    
        
            
                
                
                    
                    
                
    
                ...
    
                
                    
                        
                        
                    
                
            
        
    
    

    Your omnifaces.ListIndexConverter to the rescue :)

提交回复
热议问题