Stored Procedure within JSP
Hello sir,
I would like to know of how we can call a stored procedure and sql statement within a JSP.
I also need to build a Java interface for JSP to interact with crystal reports.
Could anyone recommend any book or forward me the url's where I can find the related material with examples.
Eagerly Waiting for reply!
Thanks,
Prathima.
# 4
> I would like to know of how we can call a stored
> procedure and sql statement within a JSP.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This may be possible, but highly discouraged. Why?
Why are you trying to write JDBC code in a JSP?
JSPs are best suited for displaying the View, so move the
JDBC code to application layer, then store the ResultSet in an
ArrayList, close the resultset, statement and connection.
Access the ArrayList with jsp:useBean, make use of Serlvets
to pass the ArrayList from JDBC layer to JSP , in Http Request scope
Read Front Controller and DAO patterns here:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
http://java.sun.com/blueprints/corej2eepatterns/Patterns/FrontController.html
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
Also, I am guessing that you may be using JSP Scriptlets , in this case I encourage you to switch to the new way of writing JSPs with JSTL 1.1.x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Take a look at JSTL SQL tags, and read online articles and tutorials on them
although writing SQL inside JSPs is highly discouraged, the JSTL SQL tags at least make it a little bit elegant.
> I also need to build a Java interface for JSP to
> interact with crystal reports.
I dunno about Crystal Reports, try their forum if they have one. Some people on this forum know about it too. But this is a separate concern.
1 question at a time please.
> Could anyone recommend any book or forward me the
> url's where I can find the related material with
> examples.
DrClap has already answered your question there.
> Eagerly Waiting for reply!
> Thanks,
> Prathima.
I also encourage you to take a look at this http://www.catb.org/~esr/faqs/smart-questions.html at your leisure.
Also every topic has it's own forum, (covered in the above link).
Here's a list of forums
http://forum.java.sun.com/index.jspa?tab=java
Your question belongs to the JDBC or the JSP forum. But now you have my answer above. This is just as a note when you post in the future.