I (new to jsp, a unix/oracle admin trying to learn java) am using Tomcat5.0.7 alpha, jdk1.4.2, jstl 1.0.3. I followed the book step by step.
bookDB.jsp (p91-92):
I have to replace
<td><c:out value="${row.id}" /></td>
<td><c:out value="${row.title}" /></td>
<td><c:out value="${row.price}" /></td>
with
<td>${row.id}</td>
<td>${row.title}</td>
<td>${row.price}</td>
otherwise it does not work.
bookDB2.jsp (p94-95)
It does not work for me. I can tell the problem is with the <sql:update>, but don't know how to fix it.
if I take out the <sql:update> part from the following <c:if> code
<c:if test="${param.title != null}">
<sql:update dataSource="${datasource}">
insert into book (title, price) values (?, ?)
<sql:param value="${param.title}" />
<sql:param value="${param.price}" />
</sql:update>
</c:if>
and still keep the empty <c:if></c:if>, the jsp at least compiles and runs.
The error code start with (got the same kind of error in bookDB.jsp if using <c:out> tag as the book does):
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(
Js pCompilationContext.java:561)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
root cause
java.lang.IllegalArgumentException: -7
org.apache.jasper.compiler.SmapStratum$LineInfo.se tOutputLineIncrement(SmapStratum.java:124)
org.apache.jasper.compiler.SmapStratum.optimizeLin eSection(SmapStratum.java:221)
org.apache.jasper.compiler.SmapUtil.evaluateNodes( SmapUtil.java:490)
org.apache.jasper.compiler.SmapUtil.generateSmap(S mapUtil.java:123)
..........
any help would be appreciated,
Shen Huang