How to convert from object to String?
How to conve开发者_运维百科rt arraylist selectitem to string.I am getting as object.Please help me...
List<SelectItem> DtlLst = new ArrayList<SelectItem>();
DtlLst.add(new SelectItem(DtlVO.getTrnId(),
DtlVO.getTrnId()));
---
---
String number =new String(DtlLst.get(0).toString());
System.out.println("number"+number.toString());
I am getting as object.How to get this list first value ?
Have you tried implementing the toString
method of SelectItem
?
Preferrably override toString as @Jim has suggested.
Alternatively you could use ToStringBuilder.reflectionToString(YourObject) although there might be a performance penalty to pay since it is using reflection.
精彩评论