I'm just beginning to learn JSP and have come across a strange thing that I can't seem to find a simple solution to.
I work with Tomcat v5.5 and mySQL 4.
the JSP code is:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/javatest">
select id, foo, bar, address from testdata
</sql:query>
<html>
<head><title>DB Test</title></head>
<body>
<h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
Id ${row.id}<br/>
Foo ${row.foo}<br/>
Bar ${row.bar}<br/>
Address ${row.address}<br/>
</c:forEach>
</body>
</html>
It's nothing much just get some data from mySQL and display it.
I'm expecting this:
Results
Id
1
Foo text
Bar
1
Address text2
But I'm getting this:
Results
Id
4294967297
Foo text
Bar
4294967297
Address text2
It's really confusing. The id and bar datatypes in mySQL are integers btw
Maybe it's a simple problem but could someone please help me sort this out?