I am new to JSTL and I'm trying to debug a forEach statement that is iterating through the columns in one row pulled from a database. The value of the column is not printing correctly when it's empty and I'm having a hard time figuring out why. Here is the code:
If the value is not empty, the value is displayed. While if it IS empty, the "-" should display (but it's not). In fact I can't get anything to display if the value of the column variable is blank/null.
1) Does anyone know what is wrong with this ternary statement?
2) Is it possible to print out the value of the column variable using a scriptlet and System.out.println so that I can have a clue what is going on with this variable?
Thanks for the pageContext hint. I was able to get the SQL statement that was being called and when I run that directly against the database, the statement returns ALL columns. However, when I run it in through the JSP it is actually skipping 3 of the columns.
However I've found that if I change the
All the columns are displayed. What could the "rowsByIndex" be doing here to hide some of these columns?
What could the "rowsByIndex" be doing here to hide some of these columns?
You'd have to look at the getRowsByIndex() method of whatever 'stats' is to find out.
Joined: Oct 14, 2004
Thanks all for the suggestions. I found the problem, and it wasn't on the rows or rowsByIndex (although I am still not sure why "rows" was working when according to my debugging, it shouldn't have). The issue was with the
line. The variable "date_format" was null and I suppose these JSTL tags must do some sort of error handler because there was no null pointer exception being thrown.
For anyone who is curious, I had to tear apart the "stats" variable which was a Result object to look at what getRowsByIndex returned and this is how I did it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com