unterminated<sql:setDataSourcetag>
Hi,
I've been trying to incorporate jstl into my coding but am getting this error:
unterminated<sql:setDataSourcetag>
Besides that, I have problem with the below syntax:
<sql:setDataSource var="dataSource" driver="jdbc:mysql://localhost:3306/pract1","root", "ABC"/>
Hope that someone can point out to me what's wrong with my codes. Many thanks.
Code :
<%
response.setHeader("Cache-Control", "no-cache"); //HTTP 1.1
response.setHeader("Pragma", "no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy server
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@page language="java" import ="java.sql.*" %>
<%@page language="java" import ="java.sql.*" %>
<sql:setDataSource var="dataSource" driver="jdbc:mysql://localhost:3306/pract1","root", "ABC"/>
<sql:query var="members" dataSource="${dataSource}" maxRow ="3">
Select *, GROUP_CONCAT(subject.subjectName SEPARATOR \", \") AS Subj from members LEFT JOIN subinter ON subinter.tutorsID = members.id LEFT JOIN subject ON subinter.subjectID = subject.id GROUP BY members.id");
</sql:query>
<table>
<tr><td><b>Member No</b></td>
<td><b>NRIC</b></td>
<td><b>Name</b></td>
<td><b>Email</b></td>
<td><b>Address</b></td>
<td><b>Subject</b></td>
</tr>
<c:forEach var="row" items="${members.rows}">
<tr>
<td><c:out value="${row.ID}" /></td>
<td><c:out value="${row.strMemberName}" /></td>
<td><c:out value="${row.strNRICNO}" /></td>
<td><c:out value="${row.strEmail}" /></td>
<td><c:out value="${row.strAddress}" /></td>
<td><c:out value="${row.Subj}" /></td>
</tr>
</c:forEach>
</table>
<% out.print("<td><a href=\"update.jsp?ID=" + ID + "\">Modify</a></td>");%>
<% out.print("<td><a href=\"DeleteMember.jsp?ID=" + ID + "\">Delete</a></td>");%>
<td>
<%no++;%></td></tr>
</table>
Re: unterminated<sql:setDataSourcetag>
It's not something simple, like the fact that you've got comma-separated string fields just floating about in your element ("root" and "ABC"), and no space before the terminating '/', is it? Perhaps the XML parser has helped you out by turning them into child text nodes and so expects a closing tag? Just a guess.
Re: unterminated<sql:setDataSourcetag>
Quote:
Originally Posted by
Sean4u
It's not something simple, like the fact that you've got comma-separated string fields just floating about in your element ("root" and "ABC"), and no space before the terminating '/', is it? Perhaps the XML parser has helped you out by turning them into child text nodes and so expects a closing tag? Just a guess.
I've tried to correct the statement to below :
<sql:setDataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://
localhost:3306/pract1" user="root" password="tangara8"/>
and it works.
But, now I am getting another error: :confused:
java.lang.NoClassDefFoundError: org/netbeans/modules/web/project/ant/JspCSingle
Caused by: java.lang.ClassNotFoundException: org.netbeans.modules.web.project.ant.JspCSingle
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
Could not find the main class: org.netbeans.modules.web.project.ant.JspCSingle. Program will exit.
I hope someone can advise why the above error message. Thanks.