SQL tags in JSTL

First time i looked at the java standard tag library, i wondered what the use was of the sql tags. You shouldn’t really be using these in any serious web application, as they don’t really follow MVC. SQL statements belong in DAO’s, OR-mappers, EJB’s or maybe in Struts actions but not in a jsp page.

However, recently i’ve started using them and they turn out to be really useful. I’m doing quite a lot of batch related oracle work, run large jobs, with no good ui to monitor what’s going on. So i have a lot of queries, usually embedded in shell scripts, which will show me what’s going on.

Now with these sql tags, you can just copy past all your sql scripts in a jsp page. Takes less than five minutes, no need to write java classes, no need to start a java ide. Now you can view the output of your sql scripts in a browser.

Having your sql scripts produce html helps because it’s easier to navigate between different scripts. No need to run one query, find the relevant id’s and then run a different query with the id’s you just found. And you can just copy past the url of the output when instant messaging with collegues.

blog comments powered by Disqus