This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

jsp is not iterating over Linkedhashmap sent by servlet  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to generate table rows from LinkedHashmap sent from servlet. But whenever i execute i get empty or null map. I tried running the servlet alone to check whether the data is existing in linkedhashmap and it does. But only when i pass it to the jsp page i guess i am receiving an empty map.

Below is the code

Jsp Code:



Servlet code:


Can anyone tell me what am i doing wrong here?

Any help would be appreciated.

Thanks
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, be sure to follow Java conventions for naming. It makes it surprisingly hard to inspect code that does not.

So variables should be doc and documents, not Doc and Documents.


How do you know the map is null in the JSP?
 
Sohan Kollu
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Thank you for the edit and showing me the link to use code tags. Will follow that from next time

In the jsp i have an if condition to check whether the map is empty or null. It's not passing that condition
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are also mixing scriptlets into the mix along with JSTL. That's a big mess.

I'd recommend cleaning up the JSP and variables and reposting the code.

How are you verifying that the map is not empty/null in the servlet?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!