aspose file tools
The moose likes Beginning Java and the fly likes HashMap and For loop issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "HashMap and For loop issue" Watch "HashMap and For loop issue" New topic
Author

HashMap and For loop issue

Mike Jenkins
Ranch Hand

Joined: Jul 23, 2006
Posts: 57
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

Joined: Dec 11, 2004
Posts: 13410




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)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
v ray
Ranch Hand

Joined: Mar 15, 2007
Posts: 223
yeah, what was said above is right.
Try this instead:

[ August 15, 2007: Message edited by: v ray ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HashMap and For loop issue
 
Similar Threads
Getting the name of the requesting page
JavaBeans and Servlets
getting error while excuting the jsp page
HTTP ERROR: 500
HTTP ERROR: 500