Integrating MyFaces , Spring and Hibernate

Learn Configuring Hibernate, Spring and MyFaces (JSF):
Tutorial presented here discusses the steps to configure Hibernate, Spring
and MyFaces to use MySQL Database to build real world User
registration and login application. This is a sample user
registration and login application where new user can create an account with the
system. Existing users can access the website by providing their user name and
password.
So, let's start developing Login and Registration application using
Hibernate, Spring and MyFaces:
- About the Tutorial
This tutorial explains the integration of Hibernate
and Spring Frameworks into JSF (MyFaces) and building a real world web
application. Integration of these three makes a solid framework for the
development of web application.
- Application
Architecture
In this section we will explain you the architecture of the application and
the different components that makes up the layers.
- Downloading MyFaces and creating web application
In this section we will learn how to create web application for our login
and registration example program. Alternatively you can also download the
integrated web application with source code and library files.
- Adding Spring and Hibernate Capabilities
In this section we will add Spring and Hibernate Capabilities to our web
application. So for this, we will have to add the spring and hibernate
libraries and configuration files to the web application.
- Setting up MySql database and creating tables
In this section we will create database and table into
MySQL database. Table created here will be used in sample application.
Developing Presentation Layer
- Developing
Login and Registration form and backing beans
This application starts from user login page. The authenticated user set
the user name and password in the appropriate field and is carried to the
next page with a message welcoming the user. If the user doesn't set the
correct entries then it flashes a message in the same page to indicate that
either the user name or password is incorrect.
Developing Business Layer
- Writing Business Objects
In this section we will develop the objects of business logic tier.
Business logic tier referrers to the mid tier of 3-tier web application
architecture.
Integration Tier of the Application
- Implementing
Integration tier with Hibernate
In this application we are using Hibernate to implement data access
layer. Hibernate is an open source O/R mapping framework that handles all
the persistence logic.
Wiring up everything
- Integrating
JSF, Spring and Hibernate
In this section we will explain you the process of Integrating Spring
with JSF (Java Server Faces) technology.
- Integrating presentation layer
In this section we will learn about configuring the
presentation layer.
- Integrating
Business Logic/Integration Tier
In the business logic tier web have created business objects, business
services and now we are going to integrate them using Spring framework.
- Downloading the full
code of this application
You can download the full code of the application.

|
Current Comments
1 comments so far (post your own) View All Comments Latest 10 Comments:Hi, i have some questions about the tutorial Integrating MyFaces , Spring and Hibernate, when i try to running the web application in weblogic, i got this error: weblogic.servlet.jsp.CompilationException: Failed to compile JSP /pages/registration.jsp registration.jsp:5:24: No property editor found for the bean "javax.el.ValueExpression". <f:loadBundle basename="com.mytutorial.messages" var="msg" /> ^-----------------------^ registration.jsp:18:26: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100%" columns="1" border="0" style="padding-left:10px; ^----^ registration.jsp:18:41: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100%" columns="1" border="0" style="padding-left:10px; ^-^ registration.jsp:18:52: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100%" columns="1" border="0" style="padding-left:10px; ^-^ registration.jsp:18:62: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100%" columns="1" border="0" style="padding-left:10px; ^------------------ padding-top:10px; " styleClass="top_bg"> ---------------------------------------------^ registration.jsp:19:59: No property editor found for the bean "javax.el.ValueExpression". padding-top:10px; " styleClass="top_bg"> ^------^ registration.jsp:20:44: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt1" border="0" cellpadding="0" cellspacing="0" > ^-^ registration.jsp:20:60: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt1" border="0" cellpadding="0" cellspacing="0" > ^-^ registration.jsp:20:76: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt1" border="0" cellpadding="0" cellspacing="0" > ^-^ registration.jsp:23:62: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="RoseIndia" styleClass="style4"/> ^---------^ registration.jsp:23:85: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="RoseIndia" styleClass="style4"/> ^------^ registration.jsp:28:26: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="175px" columns="3" border="0" cellspacing="0" cellpadding="0"> ^-----^ registration.jsp:28:42: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="175px" columns="3" border="0" cellspacing="0" cellpadding="0"> ^-^ registration.jsp:28:53: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="175px" columns="3" border="0" cellspacing="0" cellpadding="0"> ^-^ registration.jsp:28:69: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="175px" columns="3" border="0" cellspacing="0" cellpadding="0"> ^-^ registration.jsp:28:85: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="175px" columns="3" border="0" cellspacing="0" cellpadding="0"> ^-^ registration.jsp:29:35: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value=" "/> ^-^ registration.jsp:30:47: No property editor found for the bean "javax.el.ValueExpression". <h:graphicImage id="gi3" value="images/verticle_line.gif" ^------------------------^ registration.jsp:31:48: No property editor found for the bean "javax.el.ValueExpression". width="4" height="18"></h:graphicImage> ^-^ registration.jsp:31:59: No property editor found for the bean "javax.el.ValueExpression". width="4" height="18"></h:graphicImage> ^--^ registration.jsp:33:51: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt2" border="0" cellpadding="0" ^-^ registration.jsp:33:67: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt2" border="0" cellpadding="0" ^-^ registration.jsp:34:47: No property editor found for the bean "javax.el.ValueExpression". cellspacing="0" width="250"> ^-^ registration.jsp:34:57: No property editor found for the bean "javax.el.ValueExpression". cellspacing="0" width="250"> ^---^ registration.jsp:37:62: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="User Registration " styleClass="style1"/> ^------------------^ registration.jsp:37:94: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="User Registration " styleClass="style1"/> ^------^ registration.jsp:42:47: No property editor found for the bean "javax.el.ValueExpression". <h:graphicImage id="gi4" value="images/horizontal_line.gif" ^--------------------------^ registration.jsp:43:48: No property editor found for the bean "javax.el.ValueExpression". width="25" height="4" ></h:graphicImage> ^--^ registration.jsp:43:60: No property editor found for the bean "javax.el.ValueExpression". width="25" height="4" ></h:graphicImage> ^-^ registration.jsp:44:47: No property editor found for the bean "javax.el.ValueExpression". <h:graphicImage id="gi8" value="images/horizontal_line.gif" ^--------------------------^ registration.jsp:45:48: No property editor found for the bean "javax.el.ValueExpression". width="5" height="4" ></h:graphicImage> ^-^ registration.jsp:45:59: No property editor found for the bean "javax.el.ValueExpression". width="5" height="4" ></h:graphicImage> ^-^ registration.jsp:46:47: No property editor found for the bean "javax.el.ValueExpression". <h:graphicImage id="gi6" value="images/horizontal_line.gif" ^--------------------------^ registration.jsp:47:48: No property editor found for the bean "javax.el.ValueExpression". width="260" height="4" ></h:graphicImage> ^---^ registration.jsp:47:61: No property editor found for the bean "javax.el.ValueExpression". width="260" height="4" ></h:graphicImage> ^-^ registration.jsp:48:37: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value=" "/> ^-^ registration.jsp:49:48: No property editor found for the bean "javax.el.ValueExpression". <h:graphicImage id="gi7" value="images/verticle_line.gif" ^------------------------^ registration.jsp:50:48: No property editor found for the bean "javax.el.ValueExpression". width="5" height="100%" ></h:graphicImage> ^-^ registration.jsp:50:59: No property editor found for the bean "javax.el.ValueExpression". width="5" height="100%" ></h:graphicImage> ^----^ registration.jsp:52:54: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt3" border="0" cellpadding="0" ^-^ registration.jsp:52:70: No property editor found for the bean "javax.el.ValueExpression". <h:dataTable id="dt3" border="0" cellpadding="0" ^-^ registration.jsp:53:54: No property editor found for the bean "javax.el.ValueExpression". cellspacing="0" width="250" > ^-^ registration.jsp:53:64: No property editor found for the bean "javax.el.ValueExpression". cellspacing="0" width="250" > ^---^ registration.jsp:56:62: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="#{message.already_registered_msg}" ^---------------------------------^ registration.jsp:57:68: No property editor found for the bean "javax.el.ValueExpression". style="color:red; font-weight: bold;" ^-----------------------------^ registration.jsp:58:71: No property editor found for the bean "javax.el.ValueExpression". rendered="#{Bean.exist}"/> ^-------------^ registration.jsp:62:44: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100px" columns="2" border="0" ^-----^ registration.jsp:62:60: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100px" columns="2" border="0" ^-^ registration.jsp:62:71: No property editor found for the bean "javax.el.ValueExpression". <h:panelGrid width="100px" columns="2" border="0" ^-^ registration.jsp:63:58: No property editor found for the bean "javax.el.ValueExpression". cellspacing="2" cellpadding="0"> ^-^ registration.jsp:63:74: No property editor found for the bean "javax.el.ValueExpression". cellspacing="2" cellpadding="0"> ^-^ registration.jsp:64:54: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="User Name" styleClass="style2"/> ^---------^ registration.jsp:64:77: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="User Name" styleClass="style2"/> ^------^ registration.jsp:66:76: No property editor found for the bean "javax.el.ValueExpression". <h:inputText id="userName" value="#{Bean.userName}" ^----------------^ registration.jsp:67:72: No property editor found for the bean "javax.el.ValueExpression". required="true" size="27" /> ^----^ registration.jsp:67:84: No property editor found for the bean "javax.el.ValueExpression". required="true" size="27" /> ^--^ registration.jsp:69:44: The required attribute "for" is missing. <h:message for="userName" styleClass="errors"/> ^-------^ registration.jsp:69:58: No property editor found for the bean "javax.el.ValueExpression". <h:message for="userName" styleClass="errors"/> ^--------^ registration.jsp:69:80: No property editor found for the bean "javax.el.ValueExpression". <h:message for="userName" styleClass="errors"/> ^------^ registration.jsp:71:54: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Password" styleClass="style2"/> ^--------^ registration.jsp:71:76: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Password" styleClass="style2"/> ^------^ registration.jsp:73:79: No property editor found for the bean "javax.el.ValueExpression". <h:inputSecret id="Password" value="#{Bean.pwd}" ^-----------^ registration.jsp:74:69: No property editor found for the bean "javax.el.ValueExpression". size="27" redisplay="true" required="true"/> ^--^ registration.jsp:74:84: No property editor found for the bean "javax.el.ValueExpression". size="27" redisplay="true" required="true"/> ^----^ registration.jsp:74:100: No property editor found for the bean "javax.el.ValueExpression". size="27" redisplay="true" required="true"/> ^----^ registration.jsp:76:45: The required attribute "for" is missing. <h:message for="Password" styleClass="errors" /> ^-------^ registration.jsp:76:59: No property editor found for the bean "javax.el.ValueExpression". <h:message for="Password" styleClass="errors" /> ^--------^ registration.jsp:76:81: No property editor found for the bean "javax.el.ValueExpression". <h:message for="Password" styleClass="errors" /> ^------^ registration.jsp:78:54: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Confirm Password" styleClass="style2"/> ^----------------^ registration.jsp:78:84: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Confirm Password" styleClass="style2"/> ^------^ registration.jsp:81:68: No property editor found for the bean "javax.el.ValueExpression". value="#{Bean.confPwd}" size="27" ^---------------^ registration.jsp:81:91: No property editor found for the bean "javax.el.ValueExpression". value="#{Bean.confPwd}" size="27" ^--^ registration.jsp:82:67: No property editor found for the bean "javax.el.ValueExpression". redisplay="true" required="true"/> ^----^ registration.jsp:82:83: No property editor found for the bean "javax.el.ValueExpression". redisplay="true" required="true"/> ^----^ registration.jsp:84:45: The required attribute "for" is missing. <h:message for="confirmPassword" styleClass="errors" /> ^-------^ registration.jsp:84:59: No property editor found for the bean "javax.el.ValueExpression". <h:message for="confirmPassword" styleClass="errors" /> ^---------------^ registration.jsp:84:88: No property editor found for the bean "javax.el.ValueExpression". <h:message for="confirmPassword" styleClass="errors" /> ^------^ registration.jsp:86:54: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Email" styleClass="style2"/> ^-----^ registration.jsp:86:73: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Email" styleClass="style2"/> ^------^ registration.jsp:88:75: No property editor found for the bean "javax.el.ValueExpression". <h:inputText id="email" value="#{Bean.email}" size="27" ^-------------^ registration.jsp:88:96: No property editor found for the bean "javax.el.ValueExpression". <h:inputText id="email" value="#{Bean.email}" size="27" ^--^ registration.jsp:89:66: No property editor found for the bean "javax.el.ValueExpression". required="true"/> ^----^ registration.jsp:91:46: The required attribute "for" is missing. <h:message for="email" styleClass="errors" /> ^-------^ registration.jsp:91:60: No property editor found for the bean "javax.el.ValueExpression". <h:message for="email" styleClass="errors" /> ^-----^ registration.jsp:91:79: No property editor found for the bean "javax.el.ValueExpression". <h:message for="email" styleClass="errors" /> ^------^ registration.jsp:93:54: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Address" styleClass="style2"/> ^-------^ registration.jsp:93:75: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value="Address" styleClass="style2"/> ^------^ registration.jsp:95:78: No property editor found for the bean "javax.el.ValueExpression". <h:inputText id="address" value="#{Bean.address}" ^---------------^ registration.jsp:96:69: No property editor found for the bean "javax.el.ValueExpression". size="27" required="true"/> ^--^ registration.jsp:96:83: No property editor found for the bean "javax.el.ValueExpression". size="27" required="true"/> ^----^ registration.jsp:98:47: The required attribute "for" is missing. <h:message for="address" styleClass="errors" /> ^-------^ registration.jsp:98:61: No property editor found for the bean "javax.el.ValueExpression". <h:message for="address" styleClass="errors" /> ^-------^ registration.jsp:98:82: No property editor found for the bean "javax.el.ValueExpression". <h:message for="address" styleClass="errors" /> ^------^ registration.jsp:100:54: No property editor found for the bean "javax.el.ValueExpression". <h:outputText value=" "/> ^-^ registration.jsp:101:57: No property editor found for the bean "javax.el.ValueExpression". <h:commandButton value="sub" image="images/submit_button.gif" ^---^ registration.jsp:101:69: No property editor found for the bean "javax.el.ValueExpression". <h:commandButton value="sub" image="images/submit_button.gif" ^------------------------^ registration.jsp:102:53: No property editor found for the bean "javax.el.MethodExpression". action="#{Bean.register}"/> ^----------------^ at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:298) at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:216) at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:165) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235) at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:394) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:309) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:528) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261) at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414) at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3393) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(Unknown Source) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200) at weblogic.work.ExecuteThread.run(ExecuteThread.java:172) but i when running in Tomcat the web application is fine, anybody has an idea about this error. Please, help me!!!. regards Roberto
Posted by Roberto S on Friday, 03.7.08 @ 10:23am | #51797