Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mysql data not showing in JSF  RSS feed

Darius rib
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to show mysql data in JSF using this example . I figured out what <h:dataTable value="#{userBean.getUserList()}" var="u" border="1"> must be <h:dataTable value="#{userBean.userList}" var="u" border="1"> but getting error:

09:08:38,654 ERROR [stderr] (http-- at org.jboss.modules.ConcurrentClassLoader.performLoadClass(

09:08:38,654 ERROR [stderr] (http-- at org.jboss.modules.ConcurrentClassLoader.loadClass(

09:08:38,654 ERROR [stderr] (http-- at java.lang.Class.forName0(Native Method)

09:08:38,654 ERROR [stderr] (http-- at java.lang.Class.forName(Unknown Source)

09:08:38,654 ERROR [stderr] (http-- at

09:08:38,654 ERROR [stderr] (http-- at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)

09:08:38,654 ERROR [stderr] (http-- at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

09:08:38,654 ERROR [stderr] (http-- at java.lang.reflect.Method.invoke(Unknown Source)

09:08:38,655 ERROR [stderr] (http-- at javax.el.BeanELResolver.getValue(

09:08:38,655 ERROR [stderr] (http-- at com.sun.faces.el.DemuxCompositeELResolver._getValue(

09:08:38,655 ERROR [stderr] (http-- at com.sun.faces.el.DemuxCompositeELResolver.getValue(

09:08:38,655 ERROR [stderr] (http-- at org.apache.el.parser.AstValue.getValue(

09:08:38,656 ERROR [stderr] (http-- at org.apache.el.ValueExpressionImpl.getValue(

09:08:38,656 ERROR [stderr] (http-- at com.sun.faces.facelets.el.TagValueExpression.getValue(

09:08:38,656 ERROR [stderr] (http-- at javax.faces.component.ComponentStateHelper.eval(

09:08:38,656 ERROR [stderr] (http-- at javax.faces.component.ComponentStateHelper.eval(

09:08:38,656 ERROR [stderr] (http-- at javax.faces.component.UIData.getValue(

09:08:38,656 ERROR [stderr] (http-- at javax.faces.component.UIData.getDataModel(

09:08:38,656 ERROR [stderr] (http-- at javax.faces.component.UIData.setRowIndex(

09:08:38,656 ERROR [stderr] (http-- at com.sun.faces.renderkit.html_basic.TableRenderer.encodeEnd(

09:08:38,656 ERROR [stderr] (http-- at javax.faces.component.UIComponentBase.encodeEnd(

Please help
Tim Holloway
Posts: 18720
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Darius!

I recommend that you forget that you ever saw that website or anything in it. It's all wrong, and not just the parts you've already discovered.

There should have been a secondary stacktrace I think telling more what's wrong, plus the actual Exception line is missing. Although based on the sample code, I'd say that the database driver wasn't in the classpath.

J2EE is an expensive platform in terms of the amount of effort it takes to develop a webapp. So one of the things you would normally do is use a database connection pool instead of grabbing a driver directly. BTW, Class.forName() for drivers hasn't been necessary for quite a few years now, since modern JDBC drivers contain the necessary meta-data already.

A connection pool allows 2 benefits.

1. It allows multiple users access to the database without having to have each use open a new connection. Creating connections is a lot of work, but re-using pooled connections is not.

2. It allows you to abstract yourself more from the database, since the database connections are defined to the webapp server instead of to the webapp itself. While SQL isn't quite portable enough that you can swap MySQL for MS SQL Server without risk, it does make it a lot easier.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!