Take a look at this:
http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml
You just have to change the driver to use MSSQL.
Basically this:
String driver = "org.gjt.mm.mysql.Driver";
to:
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
and
String url="jdbc:mysql://localhost/books?user=<user>&password=<password>";
to:
String url = "jdbc:microsoft:sqlserver://<server_name>:<1433>"
And finally:
con=DriverManager.getConnection(url);
with
con=DriverManager.getConnection(url, usr, pwd );
Although this is not the best way to connect a web app with a database, it will be a good start for you to understand the basics of JDBC.
A better second approach would be to access the database from a java object, and call invoke methods on that class.
You can later load the connection from a connection pool, use a persistence framework and many other improvement. But I think this would be a good start.
I hope it helps.