In a report called the Daily Bulletin I have a notification section. One of the fields is entitled NARRATIVE. If the rpdnotification table is empty, can I set the value of NARRITIVE to "None at this time" and have is display the same? I have tried several times but get no results. My code for that section is as follows.
TABLE rpdnotifiation FIELDS are subject, authority, narrative, startdate, rundays, and rundays
can I set the value of NARRITIVE to "None at this time" and have is display the same?
I have no idea what you are asking as NARRITIVE [sic] (or even NARRATIVE) does not appear anywhere in your code. Java is case sensitive, as you know. Are you talking about the db column? the scripting variable?
What are you trying to set? [ September 08, 2004: Message edited by: Bear Bibeault ]
Note: when the table is empty, you get no results and your loop will never execute.
Btw, did I mention that doing SQL and dealing with result sets in a JSP page is evil? Best practice is to deal with this sort of stuff in a servlet and forward to a JSP page with a plain old collection containing your data for view.
Joined: Aug 30, 2004
Sorry - NARRATIVE refers to narrative. There is a lot more to this page than what is displayed. The actual page is over 600 lines long. I only posted the section I was having trouble with.
Tried your code - the results are still negative. Question - Does it have something to do with the WHILE LOOP. Does the LOOP have to be broken to show desired results?
Joined: Aug 02, 2004
I can't see anything wrong with your JSP code, however your HTML sucks. You've got <tr> inside <td> without an enclosing <table> (I'm not talking about outside the while loop, I mean inside it)[Edit: actually that's not true; I just didn't spot it as it wasn't indented - apologies]. You've also got extra closing tags, e.g. </strong>. It's possible that the malformed HTML is not helping the situation. Perhaps it's worth checking that out. Meanwhile I'm just going to knock up a quick example.
Now, after all that I think I may have completely missed the point which is, as Bear has said, that if you're not getting any results back then your loop will never be executed, your rows will never be created and you won't get any output beyond the static stuff. If you want to display "none at this time" when there are no results you'll need to check that after you've executed your query and display your message instead of doing the while loop.
Hope this helps.
Joined: Aug 30, 2004
Took your adive and solved the Null Argument Problem. I attacked the problem form a new angle and ended up successful. I used the following code.
bullNotificationTrue.jsp - Displays Query Results bullNotificationFalse.jsp - Displays "None at this time"