Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: unterminated<sql:setDataSourcetag>

  1. #1
    Member
    Join Date
    Jul 2011
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.
    <%
                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>

  2. #2
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default 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.

  3. #3
    Member
    Join Date
    Jul 2011
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: unterminated<sql:setDataSourcetag>

    Quote Originally Posted by Sean4u View Post
    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:

    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.