JSTL SQL
In my jstl page, i am using this query using PostgreSQL db >
select * from someTable limit 35
this returns the top 35 rows, but what i want to do is return the top 35 rows, except the first row, so I want to display rows 2 till 35.
how can i do this?
answered my own question, just use NOT LIKE
Similar Messages
-
JSTL sql tags with jndi datasource
Im trying to use JSTL sql tags but get "no suitable driver" when trying to connect
to a jndi datasource. the jakarta dbtags works fine but jstl does not
I figured it out but I'll leave it up to BEA to tell everyone how to doit.
"Fred Forester" <[email protected]> wrote:
>
>
>Im trying to use JSTL sql tags but get "no suitable driver" when trying
>to connect
>to a jndi datasource. the jakarta dbtags works fine but jstl does not
-
Class not found javax.servlet.jsp.jstl.sql.Result in Richfaces
When I try to run the richfaces application using Weblogic 10.3 AS and Netbean IDE 6.9.1, I found ClassNotFoundException on javax.servlet.jsp.jstl.sql.Result class.
I class path the following libs.
commons-beanutils-core-1.8.0.jar
commons-digester-1.8.jar
commons-fileupload-1.2.1.jar
commons-io-1.2.jar
commons-logging-1.1.1.jar
glassfish.el_2.1.1.jar
glassfish.jsf_1.2.9.0.jar
javassist-3.8.0.GA.jar
jhighlight-1.0.jar
jsf-facelets.jar
jsf-api.jar
log4j-1.2.14.jar
richfaces-api-3.3.0.GA.jar
richfaces-impl-3.3.0.GA.jar
richfaces-ui-3.3.0.GA.jar
glassfish.jstl_1.2.0.1.jar
Also I try to deploy without using some jar files already exists in application server.
My web.xml configuration is-
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>#{skinSelector.skin}</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.SKIN</param-name>
<param-value>skin_name</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
I also try to configure <library-ref>....</libray-ref> configuration in weblogic.xml and weblogic-application.xml and I also deploy JSF-2.0.war as library in application.
Please
h5.MUTUSo why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes. -
Pass jstl sql query result to jsp
Hi I have the following code which works perfectly
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<sql:setDataSource dataSource="jdbc/dbtest"/>
<sql:query var="items" sql="SELECT * FROM homepagesubscriptions">
</sql:query>
<table border="0" align="center" valign="top">
<c:forEach var="row" items="${items.rows}" begin = "0" end="10" >
<tr>
<td>
<img src="${row.imgurl}" width="100" height = "100"></a>
</td>
<tr>
</c:forEach>
</table> Now what I want is to perform the query in one page and then display the data in another, as such
index.jsp
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<sql:setDataSource dataSource="jdbc/dbtest"/>
<sql:query var="items" sql="SELECT * FROM homepagesubscriptions">
</sql:query>
<!-- NOT SURE WHAT TO DO HERE
<jsp:useBean id="resultBean" scope="request"
class="javax.servlet.jsp.jstl.sql.ResultSupport" />
<jsp:setProperty name="rs" property="rs" />
<jsp:forward page="test.jsp" />
-->
test.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="items" value="${resultBean}" />
<table border="0" align="center" valign="top">
<c:forEach var="row" items="${items.rows}" begin = "0" end="10" >
<tr>
<td>
<img src="${row.imgurl}" width="100" height = "100"></a>
</td>
<tr>
</c:forEach>
</table> I know in index.jsp I can use jsp forward and usebean but am not sure how to? What type is the result from the query? thanksTake a look at the "scope" attribute of the <sql:query> tag.
query.jsp:
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<sql:setDataSource dataSource="jdbc/dbtest"/>
<sql:query var="items" scope="request" sql="SELECT * FROM homepagesubscriptions"/>
<jsp:forward page="test.jsp" />and then test.jsp:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<table border="0" align="center" valign="top">
<c:forEach var="row" items="${items.rows}" begin = "0" end="10" >
<tr>
<td>
<img src="${row.imgurl}" width="100" height = "100"></a>
</td>
<tr>
</c:forEach>
</table> -
Help on JSTL sql:query / tag
Hi.....
Currently i am trying to query a date from MSSQL using <sql> tag. I had tested in MSSQL on this SQL statement which is:-
SELECT * FROM hr_leave WHERE startDate LIKE 'Apr 20 2006%'
It can query my MSSQL datetime.
Then , I apply this query inside my JSP/JSTL page which is :-
<%@ include file="/common/header.jsp" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<jsp:useBean id="now" class="java.text.SimpleDateFormat"/> <!-- get current date -->
<c:set var="userid" value="${sessionScope.currentUser.id}"/> <!-- get current user id -->
<c:set var="dates"><fmt:formatDate value="${now}" type="DATE" pattern="MMM dd yyyy"/></c:set>
<sql:setDataSource var="ds" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://192.168.250.86:1223;DatabaseName=eleavedb;SelectMethod=cursor" user="sa" password="sapassword"/>
<sql:query var="countLeave" dataSource="${ds}">
SELECT * FROM hr_leave_entry WHERE startDate LIKE (?, '%')
<sql:param value="${dates}"/>
</sql:query>
From the code above it displayed an an error for me. I am worried whether my select statement and my way of using the '%' symbol is it not correct.
Can anyone guide me? Thank You!And the error was?
No, that sql does not look valid the way that you have written it.
Parameters are NOT copied/pasted into sql strings. They replace the value directly. So the correct sql would be
SELECT * FROM hr_leave_entry WHERE startDate LIKE ?
You would need to actually pass the parameter as 'Apr 20 2006%' -
JSTL - SQL Server Database Connectivity problem
Hi All
I am trying to implement DB connection using JSTL sql tag using the following code :-
<c:set value="jdbc:sqlserver://localhost;databaseName=Studentreg;user=sa;password=pass" var="URL"/>
<sql:setDataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="${URL}" user="sa" password="pass" var="stc"/>
But I am getting the error :-
exception
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
But when I am trying to implement the same using the jdbc-odbc driver It work fine. This is the code:-
<sql:setDataSource driver="sun.jdbc.odbc.JdbcOdbcDriver" url="jdbc:odbc:dsn_name" user="sa" password="pass" var="stc"/>
Please help me in this regards
Thanks in Advance
Sulfikkarjava.sql.SQLException: No suitable driverMeans that it can not find the JDBC driver in the classpath.
Make sure your Database driver is in your WEB-INF/lib directory, or [TOMCAT]/common/lib directory (or equivalent)
Cheers,
evnafets -
Javax.servlet.jsp.jstl.sql.Result and arraylist
Hi,
I try to explain my problem, I have posted in another section of forum, but perhaps this is a better place:
I'm trying to use MVC model, so I call an EJB from a servlet which returns me a javax.servlet.jsp.jstl.sql.Result object (this derive from a resultset of a query) and then I make this available to a jsp page.
I've choosen to return an javax.servlet.jsp.jstl.sql.Result object because I'd like to use this syntax:
<c:forEach var="profiloString" items="${listaProfili}" >
${profiloString.anything}
</c:forEach>Now I need to put my listaProfili object in session and permit users of my application to add and delete items from it. Finally I will update my database with the new data from listaProfili object.
If listaProfili is an arraylist I can easily add or delete item from it, but if it is a javax.servlet.jsp.jstl.sql.Result I don't know how I can do this.
If I return an arraylist object instead of an javax.servlet.jsp.jstl.sql.Result object, I can't use "<c:forEach ..." syntax.
Can anyone help me?
Thanks.So why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes. -
i have a query that i want to pass a paramater to the query goes like this
<sql:query var = "user" >
SELECT AMOUNT,flag FROM SAVINGS_ACTIVITY_DETAILS WHERE ACCOUNT_ID =? AND AMOUNT >200000 AND Flag =1 AND ACCOUNT_ACTION_ID =6 AND Treated =0 ORDER BY created_date DESC
<sql:param value="${test.accountId}"/>
</sql:query>
this will give an error on TLD attribute.................and i tested the value with the following code and it worked
<c:set value="${test.accountId}" var="u"/>
<c:out value="${u}"/>
this will print out the value nicely now i need a way to be able to pass this value to the sql query
ThanksWhich version of jstl are you using? == JSTL1.1
However the other two questions remain unanswered.
What server are you using? Version?
How are you importing the tag library?
You can find out the server info with this snippet of a JSP:
Working with server: <%= application.getServerInfo() %><br>
Servlet Specification: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %> <br>
JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %><br>
Java Version: <%= System.getProperty("java.version") %><br> -
JSTL sql:query date field has zero time part
I have a little JSP where I am using JSTL to do a query against a table "ph_application" that has a date field "rundate". This field has many different dates and times in it.
Here is the code snippet:
<sql:setDataSource url="jdbc:oracle:thin:@oraprd02:1521:ipp4" user="site" password="pmc_site"/>
<sql:query var="application" sql="select * from ph_application"/>
<c:forEach items="${application.rows}" var="row">
<tr>
<td><c:out value="${row.name}" default=" " escapeXml="false"/></td>
<td><fmt:formatDate value="${row.rundate}" type="both"/></td>
</tr>
</c:forEach>
The resulting date/time output always has a 12:00:00 AM time regardless of what is actually in the table. I have changed the fmt:formatDate to a c:out of the row.rundate.time value and it appears that the time part of the date is actually zero at this point.
Is there an inconsistancy between the oracle date type and what JSTL is expecting (somewhere)?
Any help and/or verification is appreciated.
RichardI'm running this from within JDeveloper 10g.
-
Jstl sql limit offset param???
there is an syntax error in this code
can you help me?
<sql:query var="studentList" scope="request">
SELECT * FROM student
WHERE fName LIKE ? AND
name LIKE ? AND
surname LIKE ? AND
lang LIKE ?
ORDER BY surname, name
LIMIT ? , 20
<sql:param value="%${param.firmname}%" />
<sql:param value="%${param.sName}%" />
<sql:param value="%${param.sSurname}%" />
<sql:param value="%${param.sLang}%" />
<sql:param value="${start}" />
</sql:query>The problem is that you are telling the PreparedStatement that is being made using the
sql:update tag that there is only one parameter. Both by adding just one ? and
by using just one sql:param tag (which I believe has to be 1:1 with the ?s).
Anyway, in order for the PreparedStatement to know that there is going to be multiple
parameters, you have to pass the correct amount of ?s. If it will always be three, you
would use:
<sql:update>
update my set t=1 where id in(?,?,?)
<c:forEach var="a" items="${paramValues.a}">
<sql:param>${a}</sql:param>
</c:forEach>
</sql:update>But for the more likely case where you do not know how many ?s there will be, you would use
<c:set var="aCount">
${fn:count(paramValues.a)}
</c:set>
<c:set var="sqlString">
update my set t=1 where id in(
<c:forEach begin="0" end="aCount">
</c:forEach>
</c:set>
<sql:update>
${sqlString}
<c:forEach var="a" items="${paramValues.a}">
<sql:param>${a}</sql:param>
</c:forEach>
</sql:update>You might want to check out that c:forEach ... ?, It is untested, and I am not sure how the DB will handle the extra comma.
However, unless this same update, with the same number of parameters, is likely to occur multiple
times, you are gaining no benefit from using the PreparedStatement, and you are probably better off
going with the simpler Stament syntax you already used.
<c:set var="a">
${fn:join(paramValues.a,",")}
</c:set>
<sql:update>
update my set t=1 where id in(${a})
</sql:update> -
JSTL sql:param has problems
a.jsp?id=1&id=2&id=3
<c:set var="a">
${fn:join(paramValues.a,",")}
</c:set>
when print out the value of a
${a}
is:
1,2,3
<sql:update>
update my set t=1 where id in(?)
<sql:param>${a}</sql:param>
</sql:update>
when this happens,hope have 3 datas was update
but in fact only the data whose id is 1 is update,
but if i use
<sql:update>update my set t=1 where id in(${a})
</sql:update>
all of them are updated succeed,how does it ?
Am i have some errors ?The problem is that you are telling the PreparedStatement that is being made using the
sql:update tag that there is only one parameter. Both by adding just one ? and
by using just one sql:param tag (which I believe has to be 1:1 with the ?s).
Anyway, in order for the PreparedStatement to know that there is going to be multiple
parameters, you have to pass the correct amount of ?s. If it will always be three, you
would use:
<sql:update>
update my set t=1 where id in(?,?,?)
<c:forEach var="a" items="${paramValues.a}">
<sql:param>${a}</sql:param>
</c:forEach>
</sql:update>But for the more likely case where you do not know how many ?s there will be, you would use
<c:set var="aCount">
${fn:count(paramValues.a)}
</c:set>
<c:set var="sqlString">
update my set t=1 where id in(
<c:forEach begin="0" end="aCount">
</c:forEach>
</c:set>
<sql:update>
${sqlString}
<c:forEach var="a" items="${paramValues.a}">
<sql:param>${a}</sql:param>
</c:forEach>
</sql:update>You might want to check out that c:forEach ... ?, It is untested, and I am not sure how the DB will handle the extra comma.
However, unless this same update, with the same number of parameters, is likely to occur multiple
times, you are gaining no benefit from using the PreparedStatement, and you are probably better off
going with the simpler Stament syntax you already used.
<c:set var="a">
${fn:join(paramValues.a,",")}
</c:set>
<sql:update>
update my set t=1 where id in(${a})
</sql:update> -
Help! problem about jstl sql with "LIKE?" in query
Hi All,
I have a problem about getting data by using "LIKE" in my sql statment.
here is my case:
<sql:query var="tmp">
SELECT ...... FROM ...
WHERE a LIKE ?
<sql:param value="%${param.a}%"/>
</sql:query>
Once I used "LIKE" keyword, the query failed to use this critica.
and couldn't find any match cases
thx or help
Michealbesides, i found that:
this works:
"AND a.block LIKE '%' + 'a' + '%'"
but these don't work:
"AND a.block LIKE '%' + 'a' + '' + '%'"
or
"AND a.block LIKE '' + '%' + 'cp' + '%'"
or
"AND a.block LIKE '%' + 'cp' + '%' + ''"
it seems '' is the casue of error... so strange, anyone has idea?
micheal -
Correct use of not operator in jstl sql
this is my error i need it run query for "not = to" which i thought was " !="
javax.servlet.ServletException: javax.servlet.jsp.JspException:
SELECT DISTINCT scene.scene_start, episode.episode_date, scene.scene_end
FROM scene, episode, scene_char
WHERE scene.scene_id = scene_char.scene_id
AND episode.episode_id = scene.episode_id
AND scene_char.character_id =!1
: [Microsoft][ODBC Microsoft Access Driver] Invalid use of '.', '!', or '()'. in query expression 'scene.scene_id = scene_char.scene_idI got it to work using "Not character_id =1" but the other two that you just gave didn't seem to work.
I did actual no that it was the worng way round but I had just copied that from the code and I had just tried it back to front just in case. -
I'm trying to learn to use the JSTL, but it isn't going so well. Using scriptlets, I wrote this JSP that works just fine:
<HTML>
<HEAD>
<TITLE> <%= request.getParameter("txtTitle") %> </TITLE>
<%@ page import="java.sql.*, java.util.*" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:RDM_CURRENT_11", "name", "pword");
Statement getResults = conn.createStatement();
ResultSet rs = getResults.executeQuery(request.getParameter("txtQuery"));
ResultSetMetaData rsmd = rs.getMetaData();
%>
</HEAD>
<BODY>
<H1><%= request.getParameter("txtTitle") %></H1>
<TABLE BORDER="1">
<%
int count = 0;
while (rs.next())
%>
<TR>
<%
for (int i = 1; i <= rsmd.getColumnCount(); i++)
%>
<TD>
<%= rs.getString(i) %>
</TD>
<%
count++;
%>
</TR>
<% } %>
</TABLE>
<P> Records returned: <%= count %> </P>
</BODY>
</HTML>I tried to translate most of this into JSTL as follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<HTML>
<HEAD>
<TITLE> <c:out value="${param.txtTitle}"/> </TITLE>
</HEAD>
<BODY>
<sql:setDataSource url="jdbc:odbc:RDM_CURRENT_11" driver="sun.jdbc.odbc.JdbcOdbcDriver" user="name" password="pword" var="RDM"/>
<sql:query var="dataSet" dataSource="RDM">
<c:out value="${param.txtQuery}"/>
</sql:query>
<H1><c:out value="${param.txtTitle}"/></H1>
<TABLE BORDER="1">
<c:forEach var="row" items="${dataSet.rows}">
<TR>
<c:forEach var="col" items="${row}">
<TD>
<c:out value="${col.value}"/>
</TD>
</c:forEach>
</TR>
</c:forEach>
</TABLE>
</BODY>
</HTML>Now, I get a nasty error message from Tomcat saying:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)
org.apache.jsp.queryDisplay2_jsp._jspService(org.apache.jsp.queryDisplay2_jsp:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:85)
org.apache.jsp.queryDisplay2_jsp._jspx_meth_sql_query_0(org.apache.jsp.queryDisplay2_jsp:152)
org.apache.jsp.queryDisplay2_jsp._jspService(org.apache.jsp.queryDisplay2_jsp:77)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
Apache Tomcat/5.5.4I know my OBDC data source must be set up correctly because the scriptlet version works, but the JSTL version doesn't. I'm sure this is some easy problem that I am missing because I don't know JSTL well at all. Any help is appreciated.If you don't provide a "var" attribute to export to, JSTL keeps track of it for you in the standard pageContext attribute "javax.servlet.jsp.jstl.sql.dataSource"
The query tag obviously found the datasource there.
Just spotted what I think might be your original problem:
You need ${ } signs around the datasource variable in the query tag.
ie
<sql:setDataSource url="jdbc:odbc:RDM_CURRENT_11" driver="sun.jdbc.odbc.JdbcOdbcDriver" user="name" password="pword" var="RDM"/>
<sql:query var="dataSet" dataSource="${RDM}">Cheers,
evnafets -
JSTL, MySQL, Tomcat sql:query error
Hi to everyone...
This is my first post, but since im employed now as a java developer ill be here regulary.
Right now im trying to use the JSTL to make some simple sql selects in my JSPs....
Here�s the JSP code:
<%@ page language="java" import="java.lang.*,java.util.*" %>
<%@ taglib uri="/jstl-core" prefix="c" %>
<%@ taglib uri="/jstl-sql" prefix="sql" %>
<html>
<head>
<title> A first JSP database </title>
</head>
<body>
<sql:setDataSource scope="session" var="dataSource"
url="jdbc:mysql://127.0.0.1/zolltek" driver="com.mysql.jdbc.Driver"
user="root" password="root"/>
<!-- The following UPDATE works fine.. -->
<sql:update var="users" dataSource="${dataSource}" scope="session">
INSERT INTO test VALUES (7,'Paul Oakenfold')
</sql:update>
<!-- But the select screws up.... -->
<sql:query var="users" dataSource="${dataSource}" scope="session">
SELECT * FROM test WHERE 1
</sql:query>
</body>
</html>
...and the error message:
exception :
org.apache.jasper.JasperException:
SELECT * FROM test WHERE 1
: null
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
root cause
javax.servlet.ServletException:
SELECT * FROM test WHERE 1
: null
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:531)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:84)
...and just for completion the importent part of my web.xml:
<taglib>
<taglib-uri>/jstl-core</taglib-uri>
<taglib-location>/WEB-INF/c-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/jstl-sql</taglib-uri>
<taglib-location>/WEB-INF/sql-1_0.tld</taglib-location>
</taglib>
i am using the jboss 3.2.3 tomcat bundle (tomcat 4.1.29)
and mysql 4.0.18 on W32 System....
the JSTL is installed and working - i can make <sql:update>Inserts without any problems, but any <sql:query>selects result in that error... so i guess the setDataSource is okay...
Any idea would be appreciated....
Thx
J�rgThose URIs you've got in your JSPs aren't correct. They should be:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
These are the URIs defined in the standard.jar.
You'd be better off setting up a Tomcat JNDI data source for your application. That will externalize the connection parameters and make it unnecessary to refer to a data source in your JSPs.
You'd be even better off not putting SQL code in your JSPs. They're for presentation. Better to write a Java object that will communicate with the database on the JSP's behalf.
If you just want to select all the rows in the table, the query should be "SELECT * FROM test". You don't need a WHERE clause in that case.
If you change the URIs in your JSPs you should remove the <taglib> from your web.xml. It's not necessary. Tomcat will find the TLD by looking in the JARs in the CLASSPATH and matching the URIs.
Maybe you are looking for
-
Hi All, Does anyone know how to create a tcode for reports created in FGI3? I tried assigning the program name into a tcode but when I am trying to run the new tcode the selection screen is different from the report painter and it does not retrieved
-
Cumulative quantity has exceeded still billing have condition value.
Hi, Requirement – One discount condition which will be applicable up to a certain quantity at billing. Issue – Condition is getting determined at billing while cumulative quantity has exceeded.( I am using pricing type C in copy control delivery to b
-
Can't shut down..
If someone could help with this it would be much appreciated! When I try to shut down my MacBook Pro I get a window saying "The Finder cannot quit because some operations are still in progress" The operation in progress appears to be the trash window
-
About the physical path for data archive
Hi guys, Now we're doing the archive work.As our PRD system is a CI+DI system which has two servers just let me call them 63 and 64 here.We mount a media on 63's root directory.So 64 cannot recognize the media indeed.And the background job of delete
-
OVM Virtual Michine Management Questions. Required to make decision on dep.
Hi Guys, I'm new to OVM 3.1.1 and have been testing the product for about a week as we are looking at making a decision on whether or not we will be deploying it in production. I have the following question about the latest release (which i'm running