Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Adding info to mysql database with JSP

Options
  • 07-02-2006 2:28pm
    #1
    Registered Users Posts: 488 ✭✭


    Hi, Im trying to add information to the database using a form in JSP..Im getting the following error when i try to load the jsp page on the tomcat server

    The error is:

    org.apache.jasper.JasperException: /index.jsp(12,24) Unterminated <c:if tag


    This is my code..
    <%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
    <%@ taglib uri = "http://java.sun.com/jsp/jstl/sql" prefix = "sql"%>
    
    <sql:setDataSource var = "datasource"
    driver = "com.mysql.jdbc.Driver"
    url = "jdbc:mysql://localhost/jspod"
    user = "root" password = "secret" />
    
    <c:if test="${param.title != null}">
    <sql:update dataSource="${datasource}">
    INSERT INTO subs(ID,subname,subURL,subGenre,subRating) VALUES(?, ?, ?, ?, ?)
    <sql:param value="$(param.ID)" />
    <sql:param value="${param.subname)"/>
    <sql:param value="$(param.subURL)" />
    <sql:param value="${param.subGenre)"/>
    <sql:param value="$(param.subRating)"/>
    </sql:update>
    </c:if>
    
    <sql:query var = "subs" dataSource = "$(datasource)">
    SELECT ID,subname,suburl,subgenre,subrating from subs
    </sql:query>
    <html>
    <head>
    <title> A FIRST JSP DATABASE </title>
    </head>
    <body>
    <form method = "post">
    <table border = "1">
    <tr>
    <td>ID</tr><td>subname</tr><td>subURL</tr><td>subGenre</tr><td>subRating</tr>
    </tr>
    <c:forEach var = "row" items= "${subs.rows}">
    <tr>
    <td><c:out value = "${row.ID}" /></td>
    <td><c:out value = "${row.subname}" /></td>
    <td><c:out value = "${row.subURL}" /></td>
    <td><c:out value = "${row.subGenre}" /></td>
    <td><c:out value = "${row.subRating}" /></td>
    </tr>
    </c:forEach>
    <tr>
    <td>&nbsp:</td>
    <td><input type = "text" name = "subname" size = "30" /></td>
    <td><input type = "text" name = "subURL" size = "30"/></td>
    <td><input type = "text" name = "subGenre" size = "30" /></td>
    <td><input type = "text" name = "subRating" size = "30"/></td>
    </tr>
    <tr>
    <td colapse = "3" align = "centre">
    <input type = "Submit" value = "Save new sun"/>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    


Comments

Advertisement