+jstl

alguem pode me dizer pq o código abaixo da o seguinte erro:


<sql:query dataSource="jdbc:odbc:Musica, sun.jdbc.odbc.JdbcOdbcDriver, admin, admin" var="con">
	
	SELECT artista, musica, path FROM tab_musica WHERE artista='?'
	<sql:param value='${param["id"]}'/>		
</sql:query>

erro


javax.servlet.ServletException: javax.servlet.jsp.JspException: 
	
	SELECT artista, musica, path FROM tab_musica WHERE artista='?'
			
: null
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)
	org.apache.jsp.jsp.listagem_005feagles_jsp._jspService(org.apache.jsp.jsp.listagem_005feagles_jsp:342)
	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

java.lang.NullPointerException
	sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(Unknown Source)
	sun.jdbc.odbc.JdbcOdbcPreparedStatement.setNull(Unknown Source)
	sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source)
	sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source)
	sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source)
	org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.setParameters(QueryTagSupport.java:295)
	org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doEndTag(QueryTagSupport.java:214)
	org.apache.jsp.jsp.listagem_005feagles_jsp._jspx_meth_sql_query_0(org.apache.jsp.jsp.listagem_005feagles_jsp:385)
	org.apache.jsp.jsp.listagem_005feagles_jsp._jspService(org.apache.jsp.jsp.listagem_005feagles_jsp:91)
	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)

to passando o parametro id. A instrunção <sql:param value=’${param[“id”]}’/> n se aplica ao SELECT, apenas a INSERT INTO

como e q eu faço p pegar o parametro q eu passei e colocar como parametro na consulta com SELECT?

falae

faz assim:

nao sei quanto ao datasource, mas pra passar parametro tire as aspas do ? e use param.id

&lt;sql:query dataSource="jdbc:odbc:Musica, sun.jdbc.odbc.JdbcOdbcDriver, admin, admin" var="con"&gt;
	
	SELECT artista, musica, path FROM tab_musica WHERE artista=?
	&lt;sql:param value='${param.id}'/&gt;		
&lt;/sql:query&gt;