Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6681059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:32:50+00:00 2026-05-26T04:32:50+00:00

<%@taglib prefix=c uri=http://java.sun.com/jsp/jstl/core %> <%@taglib prefix=sql uri=http://java.sun.com/jstl/sql %> <sql:setDataSource var=dataSource driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/cloud user=root password=root

  • 0
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>

<sql:setDataSource var="dataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/cloud" user="root"  password="root"
scope="session" /> 

<sql:query var="qryProvider" >
    SELECT * FROM `provider`;
</sql:query>

<table>
    <c:forEach var="row" items="${qryProvider.rows}">
        <tr>
            <td>${row.display_name}</td>

        </tr>
    </c:forEach>
</table>

I got the following error:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /testJSTL.jsp at line 8

5: url="jdbc:mysql://localhost:3306/cloud" user="root"  password="root"
6: scope="session" /> 
7:  
8: <sql:query var="qryProvider" >
9:     SELECT * FROM `provider`;
10: </sql:query>
11:  


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:567)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.lang.NullPointerException"
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
    org.apache.jsp.testJSTL_jsp._jspService(testJSTL_jsp.java:94)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

I tried to follow this tut, but it gives me an error if I write

<sql:query var="qryProvider" dataSource="${dataSource}" >

I’m new to this, could someone point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:32:50+00:00Added an answer on May 26, 2026 at 4:32 am

    My advice would be to forget about the <sql> tags completely, and to make all your database operations in plain Java (in a servlet or action of your preferred MVC framework). This servlet would build a list of bean instances, ready to be displayed by your JSP. Use RequestDispatcher to dispatch the request to the JSP from the servlet.

    Even the official Java EE tutorial says:

    The JSTL SQL tags for accessing databases listed in Table 7-7 are
    designed for quick prototyping and simple applications. For production
    applications, database operations are normally encapsulated in
    JavaBeans components.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JSP code snippet: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c%> <c:choose> <c:when test=${var1.properties[\Item Type\]
This is my JSP page's taglib directive: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c %> I'm getting
<%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core %> <%@ page import=com.library.controller.*%> <%@ page import=com.library.dao.* %> <%@ page
I have a simple scrollableDataTable in a jsf <%@ taglib uri=http://java.sun.com/jsf/core prefix=f %> <%@
I've a JSP with <%@taglib uri=http://java.sun.com/jsf/facelets prefix=ui %> However it errors with The absolute
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar
Here is my jsp file: <%@ page contentType=text/plain %> <%@ page pageEncoding=UTF-8%><%@ taglib uri='http://java.sun.com/jsp/jstl/core'
I created a WCF service that uses TagLib# ( http://developer.novell.com/wiki/index.php/TagLib_Sharp ) which relies on
I use struts-html to generate forms fields. For example: <%@ taglib prefix=html uri=/WEB-INF/taglibs/struts-html.tld %>
I have a tabbedpanel declared like so : <%@ taglib prefix=sj uri=/struts-jquery-tags%> <sj:tabbedpanel id=mytabs2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.