Results 1 to 8 of 8
  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    446
    Rep Power
    6

    Default getAttributes() method .

    I am using simple getAttributes() to return all attribute value.

    Whenever i use system.out.println(getAttributes()); it return some object value but not return string.

    How can i return the string value of attributes ???
    Mak
    (Living @ Virtual World)

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    832
    Rep Power
    6

    Default

    Hi Pandiyan,
    In which context u are using getAttributes() method? Are you working with xml?
    Last edited by RamyaSivakanth; 06-02-2009 at 01:19 PM.
    Ramya:cool:

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    446
    Rep Power
    6

    Default

    No Ramya.
    I am not working with xml.
    when i tried to do hibernate samples, I used getAttributes() to recover the attributes used in my config file.
    getAttributes() methods return map type of data.
    How can i extract attribute value from map class?
    Mak
    (Living @ Virtual World)

  4. #4
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    832
    Rep Power
    6

    Default

    I dont know much about hibernate.u ping me the package ,I will help u out
    Ramya:cool:

  5. #5
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    446
    Rep Power
    6

    Default

    Ok Ramya.

    Do you know how do use map in java.util ?
    Mak
    (Living @ Virtual World)

  6. #6
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    832
    Rep Power
    6

    Default

    Hi,
    Go thru the below code for storing key value pairs in HashMap and retreive the values and keys.U also do the samething for getAttributes.

    Java Code:
    import java.util.*;
    class  Test
    {
    	public static void main(String[] args) 
    	{
    		HashMap  hashMap = new HashMap();
    		//Map stores key value pairs.
    		hashMap.put("1","Ramya");
    		hashMap.put("2","Sivakanth");
    		//For retreival of Map keys
    
    		//Below logic iterates the key and return the value
    		Set keySet = hashMap.keySet();
            Iterator It = keySet.iterator();
            while (It.hasNext()) {
                    String key = (String)(It.next());
                    System.out.println(key + " - >" + hashMap.get(key));
            }//while
            
    
    	}
    }
    Once solved please mark it as solved.
    Ramya:cool:

  7. #7
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    446
    Rep Power
    6

    Default

    Thanks Ramya.
    I got it.
    Are you indian?it may be stupid question.If you wish answer me
    Mak
    (Living @ Virtual World)

  8. #8
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    832
    Rep Power
    6

    Default

    No nationality for Java.We are all Javaians.....


    Please close the thread once it is solved
    Ramya:cool:

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2010, 05:12 PM
  2. Replies: 1
    Last Post: 02-10-2009, 10:03 AM
  3. how to use a variable of one method in another method
    By lucasautomacao in forum New To Java
    Replies: 4
    Last Post: 10-29-2008, 02:21 PM
  4. Replies: 29
    Last Post: 09-25-2008, 07:55 PM
  5. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •