• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Temitope Adedeji
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
changing sql qery at run time on a jsp page using jstl.wot di i do set a test or something?
 
Stefan Evans
Bartender
Posts: 1780
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic