Hi,
I have a entity POJO contain some property, the Type is Data, Character, 
Interger,String
I wanne to display then in <span> Tag,


When the String Type is null, the wicket is display ok.
but the Date Type, Character Type is null, it cause some NullPoint Error in the 
browser.

so that, I write a Translate Class like this:
public class TransUtil {   
    public static String char2String(Character c) {
        if(c==null){
            return "Yes";
        }
        if (c.equals('1')) {
            return "Yes";
        } else {
            return "No";
        }
    }
    public static String int2String(Integer i){
        if(i==null){
            return "defaultMsgID_UnDefault";
        }
        
        return i.toString();    
    }
    
    public static String date2String(Date date){
        if(date==null){
            return "defaultMsgID_UnDefault";
        }
        
        return date.toString();
    }
}

I don't think is a pretty solution, and I wanne know others how to solve this 
problem?


Mead

 

Reply via email to