Connect to database using jsf?

To get connected to mysql: public void open() { try { String databaseName = "custom"; String userName = "root"; String password = "welcome"; // String url = "jdbc:mysql://localhost/" + databaseName; Class. ForName("com.mysql.jdbc. Driver").newInstance(); connection = DriverManager.

GetConnection(url, userName, password); } catch (Exception e) { System.out. Println("Not able to connect"); } } In this case there is nothing to change in web.xml. But you to add this in pom.

Xml dependency> groupId = mysql mysql-connector-java 5.1.6.

To get connected to mysql: public void open() { try { String databaseName = "custom"; String userName = "root"; String password = "welcome"; // String url = "jdbc:mysql://localhost/" + databaseName; Class. ForName("com.mysql.jdbc. Driver").newInstance(); connection = DriverManager.

GetConnection(url, userName, password); } catch (Exception e) { System.out. Println("Not able to connect"); } } In this case there is nothing to change in web.xml. But you to add this in pom.

Xml groupId = mysql mysql-connector-java 5.1.6 This was working successfully.

Here is an example using bernate and HSQL - but the basic ideas of separating the db stuff out should be valid and it includes a configured web.xml.

The query was about jsf and sql. Yours example is irrelevant to query. – Warrior Nov 27 '08 at 12:15.

Here is a very good tutorial on how to use DAO with JSF in the best way: balusc.blogspot.com/2008/07/dao-tutorial... If you are using JSF, that website can be a good place to find solutions for common problems. There are great and complete examples. Anyway, JSF is a framework that manages the view and the controller layers.

For the model layer and the access to a database there are not big difference if you use JSF or any other java web framework that manages the view/controller part of your application.

Here's another tutorial Java Web Application: Using JPA within a Visual Web JSF Application Part 1 (MySQL database) visualcplusdotnet.com/javawebjpajsfmysql....

If you are using JSF, that website can be a good place to find solutions for common problems. There are great and complete examples. Anyway, JSF is a framework that manages the view and the controller layers.

For the model layer and the access to a database there are not big difference if you use JSF or any other java web framework that manages the view/controller part of your application.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions