JSTL and Escaping Quotes (Newbie Question)

D

DartmanX

Can anyone advise me on how to escape quotes on variables passed from a
request variable via JSTL?

Currently, my code looks something like this:

<c:set var="user" value="${param.USER}" />
<c:set var="password" value="${param.PASSWORD}" />
<sql:query ...>
select * from users where user = ? and pass= ?
<sql:param value="${user}" />
<sql:param value="${password}" />
</sql:query>

Any help is always appreciated.

Jason
 
C

Chris Smith

DartmanX said:
Can anyone advise me on how to escape quotes on variables passed from a
request variable via JSTL?

Currently, my code looks something like this:

<c:set var="user" value="${param.USER}" />
<c:set var="password" value="${param.PASSWORD}" />
<sql:query ...>
select * from users where user = ? and pass= ?
<sql:param value="${user}" />
<sql:param value="${password}" />
</sql:query>

If you're talking about the SQL query, then you don't need to. The JDBC
driver will handle sending your parameters correctly. Whether that's
done by escaping quotes in your strings is up to the JDBC driver, but
the result will work somehow. You don't need to worry about it at all.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top