Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HashMap and For loop issue  RSS feed

 
Mike Jenkins
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this JSP where I have alot of fields with conditions.
I would like to make it more efficient and use a for loop.
Here is an example (showing 2 fields for example only):


It prints out Joe Miller

Now my attempt below to put this in a loop prints out null null:

Please advise.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



You're using the same string for the key and the value and neither of them is 'firstname' or 'lastname'.

In any event, this is not really a JSP specific issue.
This Java code in this scriptlet could be run from any Java program.
Moving to Java In General (Beginner)
 
v ray
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, what was said above is right.
Try this instead:

[ August 15, 2007: Message edited by: v ray ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!