• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about JSTL  RSS feed

 
Filip Nelis
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've a question about the JSTL foreach... I would like to iterate trough a list of Transaction objects.

The transaction Object looks like this:






The foreach looks like this:




The strange result I'm receiving is that the entry.id is showed but the entry.base is null even I know for sure it isn't because when trying this:



it gives the correct value....

Does someone has any idea why the elements inherrited of the abstract class are always null and those from the implementing class not and how I can fix this?


Thanks in advance,

Filip
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Transaction bean does not follow the JavaBean rules. It must in order tow ork properly with the EL.
 
Filip Nelis
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear Bibeault,

Thanks for your response.
I've updated the previous message with code tags and indeed is a lot easier to read :p.
I've updated also the accessors and mutators to follow the JavaBean rules but it's still not working.
Someone else does have any idea why it's not working???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "not working" mean?
 
Filip Nelis
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The value of entry.base is null in the foreach but isn't in the scriptlet with the out.println(trans.getBase()); ...
 
Frank Eichfelder
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the forEach-Tag, the list you are using is called
resultlist
, in the scriptlet-code the list you are using is called
returnlist
.
Are you sure you are using the same list in both cases?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!