in my each jsp page i have to write this code to connect with Mysql database

String url ="jdbc:mysql://";
Connection con = DriverManager.getConnection(url,"root", "");

now i want to make this code in a separate jsp page and then only include this page in my current jsp page where ever necessary to connect with my Database like in PHP. Is it possible in Jsp . If yes pls tell me

11 Years
Discussion Span
Last Post by jwenting

yes it's possible and no we're not going to tell you how to do it as it is (as you've already been told) extremely bad to do so.

It is in fact one of the reasons PHP is frowned upon by people who are serious about writing software rather than quickly hacking something together in the hope noone will ever have to change it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.