File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Displaying the result set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Displaying the result set" Watch "Displaying the result set" New topic

Displaying the result set

Mary Wallace
Ranch Hand

Joined: Aug 25, 2003
Posts: 138
I am having difficulty in dispalying the result frm db.
this is my query which is working fine and in the page when i use <%=s%> this I am getting error. Is something wrong what i am doing

<%=s%> giving me an error. How should i display s . System.out.println printed s correctly/
Thanks in advance
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
well it depends where you are trying to use s. because s is declared in that while loop, you can only use s in that while loop, because it takes on many values you would only want to anyway. so lets see the actual bit where you use s.
if you are going to use it within the while loop it is much easier to do:
rather than
%> <%=s %> <%
which may be what you were doing?
you probably also want to put some HTML either side of s so it's probably more like
out.println("<blah>" + s + "</blah>");
etc etc

Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 862
Look at the open source FormattedDataSet API for an easy way generating this type of dynamic text. A live demo is available at that allows you to enter any query and return it as an html table. The html table also has clickable/sortable column headers. The direct link to the sort demo is
steve - - The easiest way to generate dynamic text including HTML and XML. - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
I agree. Here's the link:
subject: Displaying the result set
It's not a secret anymore!