I have a rather simple database connection bean, which I call with a 'set'
method to set the query string, then call with a 'get' method to return the
results. My problem is that I want to dynamically affect the query using
other stored variables, such as
<jsp:setProperty name="DbAccessBean" property="query" value='<%="select
email_seq from " + request.getAttribute("tablename") %>'/>
where tablename is a variable. This works fine but I have to change the
value= portion to use single quotes (value='') instead of double quotes
(value=""). The real problem then becomes that ocassionally I have a
statement, such as an insert, which needs to have the inserted values be in
single quotes. To achieve this I end of dropping the quotes around value =
(value=).
<jsp:setProperty name="DbAccessBean" property="query" value=<%="insert into
table (name) values ('" + request.getAttribute("name") + "')" %> />
If I keep the single quotes,
<jsp:setProperty name="DbAccessBean" property="query" value='<%="insert into
table (name) values ('" + request.getAttribute("name") + "')" %> '/>
I seem to get an error because the parser I believe interprets the single
quotes in the SQL as ending the value=' statement.
My work-around seems to meet my needs, but seems rather 'ugly' (pun
intended). Any suggestions on how to approach this in a better manner?
Not that I really understand what it means but aren't I losing XML
compliancy with this work-around?
Thanks,
Joshua
_|_|_| _|_|_| _|_|_|
_| _| _|
_| _|_| _| _|_|
_| _| _| _|
_|_|_|lobal _|_|_|ommerce _|_|_|ystems
Joshua D. Lannin 4840 Pearl East Circle
Assoc.Software Engineer Suite 301-W
[EMAIL PROTECTED] Boulder, CO, 80301
Phone 303 583.2088 Fax 303 583.5100
PGP key http://infonectar.com/JL.asc
------------------------------------------
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html