Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Return sets from JSTL sql SELECT Stmt,

843838Jul 27 2005 — edited Jul 27 2005
Greeting everyone,

I have been searching through the forums looking to see if someone lese has had my problem in the past. After about a hour of reading I have decided to post.

I have a SELECT statement in a JSP ( using JSTL ). All the examples I have seen it's always SELECT * from some table and run a foreach on the rows returned. That's great, but what if I am only selecting specific items?

Here is what I mean:
 <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

<sql:query var="rs" dataSource="jdbc/mslDB">
    SELECT IP, OS
    FROM mytable
    WHERE Hostname = ?
    <sql:param value= "<%= catalog.getServerName() %>" />
</sql:query>

<html>
    <body>
        Server IP: (${rs.IP})
    </body>
</html>
This is a very scalled down version but I believe it hits where my problem is. I thought I could get the server IP valus from (${rs.IP}), but I am sadly mistaken.

Can anyone tell me how I can get that value?

Thanks for any help.

Chad
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2005
Added on Jul 27 2005
5 comments
220 views