jsp - Accessing c:var variable inside sql:param -
i facing problem in accessing jsp "core tag" in jsp "sql tag" query.
code :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <sql:setdatasource var="myds" driver="org.postgresql.driver" url="jdbc:postgresql://localhost:xxxx/xyz" user="xyz" password="test123" /> <% string user_email = session.getattribute("email").tostring(); out.println("email = "+ user_email); %> <c:set var="emailid" value= "${user_email}"/> <sql:query var="listusers" datasource="${myds}"> select * developer_apikey_registration email_id = ? ; <sql:param value="${emailid}"/> </sql:query>
i not able email value here. although checked coming correctly in session attribute.
please me in regard. new jsp in advance.
try code
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <sql:setdatasource var="myds" driver="org.postgresql.driver" url="jdbc:postgresql://localhost:xxxx/xyz" user="xyz" password="test123" /> <c:set var="emailid" value= "${sessionscope[user_email]}"/> <sql:query var="listusers" datasource="${myds}"> select * developer_apikey_registration email_id = ? ; <sql:param value="${emailid}"/> </sql:query>
hope helps !!
Comments
Post a Comment