Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with EL  RSS feed

 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must humbly admit that I've been struggling with this for three days and I need some help. I'm sure it's some dumb mistake.
Servlet code:

I'm trying to pull data from that object called "beanMap". Here's the DAO.

The map that is returned has an area such as "Shipping" as the key. The inner map has a category such as "Safety" as it's key. The bean in the inner map contains the numbers (goal, actual, etc).
By looking at the map in debug I can see that it's constructed as expected. I have a screenshot of that, but I'm not sure how to post it. The problem comes in the jsp.
(I think) I should be able to get the properties of that inner map with

Up to "statisticBeans.Shipping" gives me the toString() info, but as soon as I add the "Delivery" key of the inner map, I get null, nothing on the page. Spelling and case is correct. In debug I can drill all the way down to the goal value and see it.

I've tried bracket notation, but since I'm not dealing with Lists or Arrays, the dot notation should work just fine. I'm stumped. Suggestions, please.

I thought by posting this, the rubber duck would help me out, but even he is silent on this one.

 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm an idiot. The only thing wrong is that I forgot to do a "trim()" on the getString() methods. DB2 pads the fields with spaces out to the defined field size. Without trimming the spaces, the strings don't match.

Java didn't see a "getDelivery()" method, just a "getDelivery ()" method which of course is not the same thing.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reporting back with your findings! I'm willing to bet some future hair-tearer will come upon this and be delighted to stop the pulling!

A cow for you as I think this will help a lot of people.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I pulled a few strands over it myself, and I don't have that much left to spare.

Thanks for the cow!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J. Kevin Robbins wrote:I pulled a few strands over it myself, and I don't have that much left to spare.

If you've got any, you've got me beat.

SQL did this to me!!!

 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked at the post and I thought "Well, maybe it was... no, he said he checked that. But that's not the right way to access a Map, is it? Yeah, it is the right way. So maybe... no, he looked at that too. Maybe... nope." At that point I gave up and moved on. But yeah... I remember having to trim all those dang fixed-length fields from our DB2 database. Never would have guessed that was your problem though.
 
Arun Giridhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Cow ?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I remember having to trim all those dang fixed-length fields from our DB2 database. Never would have guessed that was your problem though.


I really shot myself in the foot with this one. Usually my SQL statements are like "select rtrim(dept), rtrim(category)..." etc. so the trimming is done on the AS400. But this time I got lazy. It's a table with only 4 fields and 24 records and I need all of them so I did a "select *". That was my undoing. Rule number 37; never, ever use "select *" even if you do need all the fields. And so endeth the lesson.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!