aspose file tools*
The moose likes JSP and the fly likes JSTL, JDBC, and Result Set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL, JDBC, and Result Set" Watch "JSTL, JDBC, and Result Set" New topic
Author

JSTL, JDBC, and Result Set

william gates
Ranch Hand

Joined: Feb 21, 2007
Posts: 112
I stored DB results in a HASHMAP and then ARRAYLIST, but it displayed my results in an order that wasn't the way I needed it.

I've been trying to store my results in an ArrayList, but for some reason, the JSP page using JSTL just displays a blank page. No results, no nothing.

Here is where I store my Array List



and here is the main display part of the JSTL page.


I'm confused as to why I can use a HashMap and ArrayList and get results to display but when I try to just use an ArrayList to store, nothing is displayed at all.
[ April 20, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

I added code tags to your post -- it makes a huge difference in the readability of your code as you can see. Please read this for more info.
[ April 20, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

nothing is displayed at all.


As in empty page, or empty table?

If the former, an error may be preventing the response from being sent.

Check your logs. And what's with the spurious ${item} in your JSP?
[ April 20, 2007: Message edited by: Bear Bibeault ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I don't see any code that binds your ArrayList to scope (request, session, etc..).
Where are you doing that?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
william gates
Ranch Hand

Joined: Feb 21, 2007
Posts: 112
It's an empty blank page.

Here is part of my servlet code.



But for whatever reason, it forwards me to a blank queryResults.jsp page.

However when I use a hashmap in the DBcode, like the code listed below, I do get results back. Albiet they aren't displayed in the order I wish them to be.





As far as logs, I don't have access to them on websphere 6.0. I run jython scripts to either update, delete or install my web application and from there I can't even read the folder on the server.. That is locked down by the server admins.
[ April 20, 2007: Message edited by: william gates ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Originally posted by william gates:
That is locked down by the server admins.


Don't know what to tell you. The blank page is indicative of an exception that is preventing the response from being sent. Without access to the logs, you're flying blind.

Can you not set up a local server for testing?
william gates
Ranch Hand

Joined: Feb 21, 2007
Posts: 112
I tested on my local system using Apache Tomcat 5 before deploying to the Websphere 6.0 development server box. But there were many issues related with new server admins, scripts, db connections, memory allocation, user accounts and so on that made it a waste to continue testing on the local Tomcat web server.

I'll try to test on Tomcat to see if I can see what's going wrong, but i'm sort of flying blind right now on the Websphere 6.0 side. The server admins have been helpful enough over the past few weeks, even though they are new to Websphere. The problem now is the two server admins are gone until May. One is in training and the other on vacation. So I can't even ask them to see if they can send me error logs.

thanks for your help.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It's not difficult to write a servlet that reads log files and streams them to the browser.

If I were working in such absurd conditions, I wouldn't write a line of anything else until I was done building one.
william gates
Ranch Hand

Joined: Feb 21, 2007
Posts: 112
Thanks.. I'll have to do that..

It's all for security reasons, which I understand. Doesn't make it easier, but it sort of makes sense. They've had one too many "missing laptop" problems and hence, a new IT Security Kingpin with all new rules, regulations and policies.

Besides that, I'm a contractor and I've had to go through many user rights, privledges, and admin issues over the past few months due to me being a non-employee. Sometimes I can't connect to a certain database until I get approved and that might take a week or two.

That's all besides the point though. I'll have to write a servlet to find out what is going wrong.

thanks,
william gates
Ranch Hand

Joined: Feb 21, 2007
Posts: 112
Sort of related to original topic..

I decided to store the DB data in a bean.. Not sure if I'm doing it right or not and definitely not sure if I set up JSTL correctly. I'm new to JSTL so not sure how it all works together at times. I get my page to display, but I don't get any results back.. Just my Table Headers(which I hardcoded in the table and no data.

Here is the JSP results page with JSTL :



Here is how I store the Java Bean.




And here is the part of my servlet




[ April 20, 2007: Message edited by: william gates ]
[ April 20, 2007: Message edited by: william gates ]
 
 
subject: JSTL, JDBC, and Result Set