Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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

User_DTTUYOct 10 2011 — edited Oct 11 2011
Hi,

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="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.*" %>

<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 = tutors.id LEFT JOIN subject ON subinter.subjectID = subject.id GROUP BY tutors.id");

</sql:query>


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?

Tks.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 8 2011
Added on Oct 10 2011
3 comments
212 views