Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Build dynamic sql query for JSTL <sql:query>

Reply
Thread Tools

Build dynamic sql query for JSTL <sql:query>

 
 
Anonymous
Guest
Posts: n/a
 
      10-13-2005
Hi,

I am using JSTL to build JSP pages. Depending on input parameters, I
want the JSP pages to query a database based on different SQL queries.

For example, instead of using the following hard-coded-in "Select"
query, I want to build the "Select *** from ***" statement dynamically.

<sql:query var="grs" dataSource="jdbc/testdb">
select distinct group_name from user_groups order by group_name
</sql:query>


For example, I'd to change above sql:query to the following example:

<% String qry= "select distinct group_name from user_groups order by
group_name
";%>

<sql:query var="grs" dataSource="jdbc/testdb">
qry
</sql:query>


Is this possible?

Thanks,

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(struts/JSTL) Setting bean property value with jstl choose compoundresults DaFoot Java 1 10-23-2008 12:42 PM
build sql query Howard ASP .Net 2 09-07-2005 04:31 PM
Custom JSTL that accepts JSTL expression Robert Mark Bram Java 0 12-15-2004 12:26 AM
SWsoft Acronis Disk Director Suite 9.0 Build 508, Acronis OS Selector 8.0 Build 917, Acronis Partition Expert 2003 Build 292, Acronis Power Utilities 2004 Build 502, F-SECURE.ANTI vIRUS.PROXY v1.10.17.WINALL, F-SECURE.ANTI vIRUS v5.50.10260 for CITRI vvcd Computer Support 0 09-25-2004 01:38 AM
Availability of Dynamic Architect - Build advanced dynamic web pages without code! jonjon Javascript 0 10-29-2003 10:10 PM



Advertisments