This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is this an array?  RSS feed

 
Jeremy Taylor
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"USER_VIEW = UserView@19713ea"

I used this code to loop over the session variables
-----------------------------------------------------------------------------
java.util.Enumeration names = session.getAttributeNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
out.println(" " + name + " = " + session.getAttribute(name) + "<br>");
}
-----------------------------------------------------------------------------
If it is an array, what's the trick to looping over it and seeing what's inside?
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If what is an array?

If you mean USER_VIEW, it's not, it's a UserView object

the 'trick' to seeing what's inside the UserView object would be to start with replacing the println with something like

if( "USER_VIEW".equals( name ) ) {
//code to output UserView properties
}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!