Hi!
I have sam eproblem getAttribute give object type Map and I think that you cant 
use ArrayList conversion, but I dont now. I try this:
 





Hello everybody!
 
I have a problem in Homework in Lab-4108. I just cant find how to display 
attribute, beacause  for UIComponent comp, comp.getAttributes() return 
Map<String,Object> m object,  so I try funcion toString(), it just wrote map to 
function getAttributeMethod, I try value() funcion  Glass Fish reported error 
message and my NetBean IDE was blocked , I just don't know what to do. I try 
with 
for (Map.Entry<String, Object> e : m.entrySet()){
    System.out.println(e.getKey() + ": " + e.getValue());
}
and my NetBean IDE was blocked.
 
I just don' know what to do?
Do we have to do this homework, or only that is numbered with #  in the topics?
But nobody answer to me, why, I don't know ?

--- On Wed, 5/6/09, lisandrodc <lisandr...@gmail.com> wrote:


From: lisandrodc <lisandr...@gmail.com>
Subject: [java ee programming] Help in Homework LAB-4108
To: "Java EE (J2EE) Programming with Passion!" 
<java-ee-j2ee-programming-with-passion@googlegroups.com>
Date: Wednesday, May 6, 2009, 8:13 PM



Hi! I have a problem with the use getAttributes() method of the
UIComponent class.
Code of the method:
public void printComponentTree2(UIComponent comp) {
     printComponentInfo(comp);

        // Get child components
       List complist =  (ArrayList)(comp.getAttributes().values());
        if (complist.size() > 0) {
            indent++;
        }
       Iterator<UIComponent> it= complist.iterator();
       while(it.hasNext()){
            printComponentTree(it.next());
       }


    }

The problem is the cast.
In console, the error:
threw exception: java.lang.ClassCastException: java.util.HashMap
$Values cannot be cast to java.util.ArrayList java.util.HashMap$Values
cannot be cast to java.util.ArrayList.....
.........................

I not find  way of the solution at the problem for display of the
attributtes.
Regards.







 


      
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java 
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to