Forum Stats

  • 3,816,058 Users
  • 2,259,135 Discussions


How to make the JSTL access my database and some syntax question.

User_DTTUY Member Posts: 5 Blue Ribbon

I've been trying and trying to make my jstl work but still not working.

Have added the resource references in tomcat.

jdbc/WebApplication1 javax.sql.DataSource Container Shareable database for WebApplication1

Not sure what other things I must do in order for my jsp page to display a table using jstl.

Hope some one can share with me.

<jsp:useBean id="Tutors" scope="session" class="databaseAccess.TutorsBean"/>
<jsp:setProperty name ="Tutors" property="*"/>
<%@ taglib prefix="c" uri="" prefix="c"%>
<%@ taglib prefix="fmt" uri="" %>
<%@ taglib prefix="sql" uri="" prefix="sql"%>
<%@ taglib prefix="x" uri="" %>

<%@page language="java" import ="java.sql.*" %>

<sql:setDataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://
localhost:3306/pract1" user="root" password="123"/>

<sql:query var="tutors" maxRows="5">
Select *, GROUP_CONCAT(subject.subjectName SEPARATOR \", \") AS Subj from tutors LEFT JOIN subinter ON subinter.tutorsID = LEFT JOIN subject ON subinter.subjectID = GROUP BY");


In MySQL I have created 3 tables by the name of tutors, subject and subinter

But, netbean IDE gave me an error on <sql:query var="tutors" maxRows="5">

So, hope someone can advise me where have I gone wrong with the syntax or what?



This discussion has been closed.