• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getAttributeNames()

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to get the names of the attributes that i have put in the application context.






i am getting

org.apache.catalina.util.Enumerator@6efbef
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
you are trying to print the enumerator object. That is why you got that output.

you have to use,

e.nextElement() method to retrieve the values.

Check whether e is having any data using the method e.hasMoreElements() before iterating.
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

# Enumeration e=(Enumeration)getServletContext().getAttributeNames();
# out.println("<html><body>");
# out.println(e);
# out.println("</body></html>");



Returns:

an Enumeration of String objects specifying the names of all the objects bound to this session.

so you have to print value of your Enumeration object use again for loop and print value.
 
Ankitt Gupta
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey thanks shruthi,nishan

i set the attribute by



leaguelist1 is a LinkedList

but now i am getting

com.sun.jsp.tagFileJarUrlsCache com.sun.jsp.tldUriToLocationMap org.apache.catalina.jsp_classpath jspx.1st.request com.sun.jsp.taglibraryCache com.sun.appserv.jsp.resource.injector com.sun.jsp.propertyGroups org.apache.catalina.WELCOME_FILES javax.servlet.context.tempdir org.apache.catalina.resources com.sun.faces.useMyFaces com.sun.servlet.webxml.version
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd imagine that yours is not the only attribute in the context.
 
reply
    Bookmark Topic Watch Topic
  • New Topic