File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes changing sql qery at run time on a jsp page using jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "changing sql qery at run time on a jsp page using jstl" Watch "changing sql qery at run time on a jsp page using jstl" New topic
Author

changing sql qery at run time on a jsp page using jstl

Temitope Adedeji
Greenhorn

Joined: Sep 08, 2006
Posts: 3
changing sql qery at run time on a jsp page using jstl.wot di i do set a test or something?
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
First the standard disclaimer
- SQL should not be in a JSP. Put the code in a bean somewhere

If you MUST put SQL on a JSP page, then at least you are using the JSTL.
It depends what you are changing about it.

The best way to make a query dynamic is to parameterize it.
ie select username, useremail from userTable where userid = ?
and then use the <sql:param> tag to specify a value for the id.

If you want to dynamically construct sql (tables, columns to select) you are much better off doing it in java code where you can test/develop it outside of the application server.

Hope this helps,
evnafets
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: changing sql qery at run time on a jsp page using jstl