Jsf spring hibernate session

Hi, I'm currently using hibernate spring and JSF  1/ the first problem In the JSF common header page I try to test if a bean is in the session scope in order to show login or logout link, and the test always fails : the logout link is always displayed.  the JSF page : [code] <f:subview id="header" >        <h:form id="headerForm"> <table cellspacing="0" width="100%"> <tr> <td align="left" valign="middle">           <img border="0" src="images/logo1.jpg"/> </td>  <td align="right" valign="middle"> <br> <!--Accueil< -->  <c:choose> <c:when test="${empty sessionScope.accountBean}">  <h:commandLink action="Sign on"> <h:outputText value="Sign on"/> </h:commandLink>  </c:when> <c:otherwise> <h:commandLink id ="logout" action="#{accountBean.logoutAction}" >      <h:outputText value="log out"/> </h:commandLink> </c:otherwise> </c:choose> </td> </tr> </table>  <table cellspacing="0" width="100%"> <tr> <td> <hr color="#99ca3c" size="5" noShade SIZE=1> </td> </tr> </table>       </h:form> </f:subview>   [/code]   The accountBean code : [code] public class AccountBean extends BaseBean{ //private Logger log = Log.getLog(this); private String uid; private String password;  private boolean loggedIn; private AdminService adminService; private Admin admin; public AccountBean() { this.logger.debug("Authentication"); this.loggedIn = false; uid=null; password=null; // admin=new Admin(); } public String loginAction() {           try { this.logger.debug("loginAction");  admin = adminService.login(this.uid, this.password); //this.serviceLocator.getUserService().login(this.username, this.password);                                if (admin != null) { if("".equals(admin.getUid())|| "".equals(admin.getPassword())){ this.loggedIn=false; String msg = "Le mot de passe et l'identifiant doivent etre saisis ";                     addErrorMessage(msg + ", saississez un mot de passe et un identifiant corrects"); return NavigationResults.RETRY; } else{                     this.loggedIn = true; HttpSession session = SessionUtil.getSession(); session.setAttribute("Admin", this.uid);                                          return NavigationResults.SUCCESS; }                }                else {                     this.loggedIn = false;                                          String msg = "Le mot de passe est incorrect ";                     addErrorMessage(msg + ", saississez un mot de passe correct");                     this.logger.debug(msg);                                          return NavigationResults.RETRY;                }           }           catch (UsernameNotExistException ue) {                String msg = "L'identifiant (login) est incorrect";                this.logger.info(msg);                addErrorMessage(msg + ", ressaysissez votre identifiant.");                                return NavigationResults.RETRY;           }           catch (Exception e) {                this.logger.error("Could not log in user.", e);                addInfoMessage("Could not log in user: Internal Error");                                return NavigationResults.FAILURE;           }      }            /**      * The backing bean action to logout a user.      *       * @return the navigation result      */      public String logoutAction() {           //this.clear(); FacesContext fc = FacesContext.getCurrentInstance(); HttpSession session = (HttpSession) fc.getExternalContext().getSession(false); session.invalidate();            this.logger.debug("Logout successfully.");                      return NavigationResults.MAIN;      }        public String getPassword() { return password; }  public void setPassword(String password) { this.password = password; }  public String getUid() { return uid; }  public void setUid(String uid) { this.uid = uid; }  public Admin getAdmin() { return admin; }   public boolean getLoggedIn() { return loggedIn; }  public void setLoggedIn(boolean loggedIn) { this.loggedIn = loggedIn; }  public void setAdminService(AdminService adminService) { this.adminService = adminService; }   }    [/code]  the faces managed bean configuration [code] <managed-bean-name>accountBean</managed-bean-name> <managed-bean-class>fr.cbmjadmin.views.bean.AccountBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property>      <property-name>adminService</property-name> <value>#{adminService}</value> </managed-property>    [/code] 2/ the second problem : my application shows a list of datas. I log on the application , i update this list outside the application ( by using sql command) , i try to list my data using the application : the application does not reflect the modifications. I logout using the log out link, then i log on and the application does not reflect the modifications.  what happens? How could I resove these problems. How can i logout properly? how can i show logout link when the user is logged in? and hide the log out link when the user is logout Thanks.

For the first problem, you need to realize that the accountBean always exists since you configured it in the faces-config.xml. So you should use something else (like a property on the bean) to determine if the user has actually logged in.
Secondly, but still on the first issue, it is preferable to use the rendered attribute on the standard JSF components in this situation, instead of the JSTL tags.
Now, as to the second problem, there are a number of possibilities:
- did you commit the changes to the database?
- did you verify that another connection with the native db client can see the changes?
- are you using a cache with Hibernate? Are you taking the proper steps to notify the cache it might have stale data?
- are you keeping the list in session scope in your application? (Logging out doesn't clear the session unless you explicitly code it that way.)

Similar Messages

  • JSF - spring - hibernate and session

    Hi,
    I'm currently using hibernate spring and JSF
    1/ the first problem
    In the JSF common header page I try to test if a bean is in the session scope in order to show login or logout link, and the test always fails : the logout link is always displayed.
    the JSF page :
    <f:subview id="header" >
        <h:form id="headerForm">
            <table cellspacing="0" width="100%">
        <tr>
            <td align="left" valign="middle">
                  <a href="front.jsf"><img border="0" src="images/logo1.jpg"/></a>
            </td>
        <td align="right" valign="middle"> <br>
       <!--<a href="front.jsf" rendered="#"> Accueil<</a> -->
        <c:choose>
                    <c:when test="${empty sessionScope.accountBean}">
                        <h:commandLink action="Sign on">
                            <h:outputText value="Sign on"/>
                        </h:commandLink>  
                    </c:when>
                    <c:otherwise>
                        <h:commandLink id ="logout" action="#{accountBean.logoutAction}" >
                             <h:outputText value="log out"/>
                        </h:commandLink>
                   </c:otherwise>
                </c:choose>
            </td>
        </tr>
    </table>
    <table cellspacing="0" width="100%">
        <tr>
            <td>
                <hr color="#99ca3c"  size="5" noShade SIZE=1>
            </td>
        </tr>
    </table>
         </h:form>
    </f:subview>The accountBean code :
    public class AccountBean extends BaseBean{
    //private Logger log = Log.getLog(this);
        private String uid;
        private String password;
        private boolean loggedIn;
        private AdminService adminService;
        private Admin admin;
        public AccountBean() {
            this.logger.debug("Authentication");
            this.loggedIn = false;
            uid=null;
            password=null;
           // admin=new Admin();
    public String loginAction() {
              try {
                        this.logger.debug("loginAction");
                         admin = adminService.login(this.uid, this.password);
                                    //this.serviceLocator.getUserService().login(this.username, this.password);
                   if (admin != null) {
                                if("".equals(admin.getUid())|| "".equals(admin.getPassword())){
                                 this.loggedIn=false;
                                    String msg = "Le mot de passe et l'identifiant doivent etre saisis ";
                        addErrorMessage(msg + ", saississez un mot de passe et un identifiant corrects");
                                 return NavigationResults.RETRY;
                                else{
                        this.loggedIn = true;
                                    HttpSession session = SessionUtil.getSession();
                                    session.setAttribute("Admin", this.uid);
                        return NavigationResults.SUCCESS;
                   else {
                        this.loggedIn = false;
                        String msg = "Le mot de passe est incorrect ";
                        addErrorMessage(msg + ", saississez un mot de passe correct");
                        this.logger.debug(msg);
                        return NavigationResults.RETRY;
              catch (UsernameNotExistException ue) {
                   String msg = "L'identifiant (login) est incorrect";
                   this.logger.info(msg);
                   addErrorMessage(msg + ", ressaysissez votre identifiant.");
                   return NavigationResults.RETRY;
              catch (Exception e) {
                   this.logger.error("Could not log in user.", e);
                   addInfoMessage("Could not log in user: Internal Error");
                   return NavigationResults.FAILURE;
          * The backing bean action to logout a user.
          * @return the navigation result
         public String logoutAction() {
              //this.clear();
               FacesContext fc = FacesContext.getCurrentInstance();
               HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);
               session.invalidate();
              this.logger.debug("Logout successfully.");
              return NavigationResults.MAIN;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
        public String getUid() {
            return uid;
        public void setUid(String uid) {
            this.uid = uid;
        public Admin getAdmin() {
            return admin;
        public boolean getLoggedIn() {
            return loggedIn;
        public void setLoggedIn(boolean loggedIn) {
            this.loggedIn = loggedIn;
        public void setAdminService(AdminService adminService) {
            this.adminService = adminService;
    }the faces managed bean configuration
    <managed-bean-name>accountBean</managed-bean-name>
        <managed-bean-class>fr.cbmjadmin.views.bean.AccountBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
         <property-name>adminService</property-name>
                <value>#{adminService}</value>
        </managed-property>2/ the second problem :
    my application shows a list of datas.
    I log on the application , i update this list outside the application ( by using sql command) , i try to list my data using the application : the application does not reflect the modifications. I logout using the log out link, then i log on and the application does not reflect the modifications.
    what happens?
    How could I resove these problems.
    How can i logout properly?
    how can i show logout link when the user is logged in? and hide the log out link when the user is logout
    Thanks.

    It depends on how you want to reprecate the session btwn instances or cluters
    there are three kinds File System, Memory to Memory, HA
    You can configure it from this property in the admin console
    Configuration on a cluster -> Availability Service -> Web Container Availability -> Persistence Type:

  • Help me out with Directory structure for JSF+SPRING+HIBERNATE Project

    Hi frnds ,
    My name is Walter working for a startup software company . We are working on Hospital Management System (HMS) project .. MVC Architecture ...using Hibernate Spring and JSF ..we need to design Directory Structure for our project..
    plzz help me friends in suggesting MVC Directory structure ...? also plzz help me by directing me with the navigation flow?
    Thnxx in advance
    Regards
    Walter

    Thank you so much .. friends ..for your kind replies..thanks to Illu, anguquga and special thanks to BalusC for giving me the advice for hiring EE Artitech ..
    Anyways I have discussed with my teammates designing the directory structure
    anguquga your directory structure is close to what I have designed ..referiing to a sample application on web..
    Hospital Management system MVC architecture Directory structure
    This is the way the structure goes on ..
    model --> for Hibernate as well as Spring
    View --> for JSF
    src(-)
    |
    ------(-) java
         |
         -------(-) model
              |
              ------(+) businessobject
              |
              ------(-) dao
              |
              ------(+) hibernate
              |
              ------(+) exception
              |
              ------(-) service
              |
              ------ (+) impl
              |
              ------(+) util
              (-) view
              |
              ------(+) bean
              |
              ------(+) builder
              |
              ------(+) bundle
              |
              ------(+) servicelocator
              |
              ------(+) util
              |
              ------(+) validator
    (-) Web or WebRoot
    |
    ----- (-) JSP Files�etc.,
    |
    ----- (-) META-INF
    |
         ------     (+) Images
    |
         ------     (+) Scripts ==== CSS (cascading style sheets, JavaScript files etc.,)
    |
    ----- (-) WEB-INF =========xml files web.xml, faces-config.xml etc.,
         |
         -----(-) Classes
              |
    -----(-) HMS
    |
                   ----- (+) model
                   |
                   ----- (+) view
    |
    ----- (+) lib
    I am sure you may notice few errors .. if u find any plzz reply me back.... thnxx in advance for replies...and thnxx for giving your valuable replies...
    Walter (Kaleem)

  • URGENT methode parametres JSF+ SPRING +HIBERNATE

    hello all the world I'm back
    help me plz :
    I want to search an employee from his number I use a search function (String number), I recalled your JSF + hibernate + spring so I'll post the code :
    code of jsp page
    <f:view>
              <h:form id="RechercheEmp">
                   <h:panelGrid columns="2">
                        <h:outputText  value="Entre le Matricule de l'employ� : "/>                    
                        <h:inputText  id="mat" value="#{todoBean.employes.matricule}"/>                    
                    <h:commandButton value="Submit" action="#{todoBean.chercherEmployer?matricule=mat}"/>
                   </h:panelGrid>
                   </h:form>
    </f:view>and code of bean JSF :
    public String chercherEmployer(String matricule) {
            log.debug("#DDD############ createemployesAction()");
            try {
                this.toDoService.chercherToDo(matricule);
                log.debug("#DDD############ checheremployesAction->success");
                return "success";
            } catch (JoTestException e) {
                e.printStackTrace();
                return "failure";
    }in layer service :
    public void chercherToDo(String matricule) throws JoTestException {
            log.debug("#DDD############ saveToDo(toDo) in Service TODO");
            toDoDao.chercherToDo(matricule);
    }and in the layer dao :
    public void chercherToDo(String matricule){
              log.debug("#DDD######### Savetodo in todoDAO : ");
              this.getHibernateTemplate().load(Employes.class, matricule);
    }but i have this probleme :
    javax.servlet.ServletException: #{todoBean.chercherEmployer?matricule=ma'}: javax.faces.el.MethodNotFoundException: chercherEmployer?matricule='mat': jotodo.gui.bean.ToDoBean.chercherEmployer?matricule='mat'()
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
    cause m�re
    javax.faces.FacesException: #{todoBean.chercherEmployer?matricule=mat}: javax.faces.el.MethodNotFoundException: chercherEmployer?matricule='mat': jotodo.gui.bean.ToDoBean.chercherEmployer?matricule='mat'()
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
         javax.faces.component.UICommand.broadcast(UICommand.java:312)
         javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
         javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    note La trace compl�te de la cause m�re de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/5.5.20.
    Apache Tomcat/5.5.20

    i changed my page jsp to this :
    <f:view>
              <h:form id="RechercheEmp">
                        <h:outputText  value="Entre le Matricule de l'employ� : "/>                    
                        <h:inputText  id="mat1" value="" />                    
                        <h:commandLink action="#{todoBean.chercherEmployer}">
                          <h:outputText value="Chercher" />
                          <f:param name="mat1" value="#{todoBean.employes.matricule}"/>
                        </h:commandLink>
                   </h:form>
    </f:view>is correct or no ?????????
    but i get again the same error :
    exception
    javax.servlet.ServletException: #{todoBean.chercherEmployer}: javax.faces.el.MethodNotFoundException: chercherEmployer: jotodo.gui.bean.ToDoBean.chercherEmployer()
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
    cause m�re
    javax.faces.FacesException: #{todoBean.chercherEmployer}: javax.faces.el.MethodNotFoundException: chercherEmployer: jotodo.gui.bean.ToDoBean.chercherEmployer()
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
         javax.faces.component.UICommand.broadcast(UICommand.java:312)
         javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
         javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)Edited by: Maq_Ichigo on Apr 29, 2008 3:09 AM
    Edited by: Maq_Ichigo on Apr 29, 2008 3:19 AM

  • JSF, Springs and Hibernate

    Hi,
    I am a newbie. I would like to know the books i need to refer to, inorder to learn JSF, springs and hibernate.
    Thank you,

    The_Matrix wrote:
    CeciNEstPasUnProgrammeur wrote:
    How about learning Java first?
    At least for JSPs, there are free online tutorials from Sun. There are likely to be similar resources for Spring and Hibernate.I Know Java. I am a Sun Certified Java Programmer. I also know know J2EE. I am trying to learn the new technologies. Therefore i mentioned that i am a newbie, it was pertianing to JSF, Springs and Hibernate. Not to Java.In that case:
    Core Java Server Faces (2nd edition)
    Java Persistence with Hibernate
    Pro Spring 2.5
    Expert Spring MVC and Web Flow
    Together with the product documentation those should make a decent bit of reading.

  • Training material on JSF, Spring and Hibernate

    Hi All,
    I'm new to JSF. I need some good training material on JSF, Spring and Hibernate.
    I've tried lot many tutorials online, but cannot find a real good one.
    Also I need to learn how we can integrate together JSF, Spring and Hibernate to build web applications.
    Thanks
    Payal

    As far as documentation vs examples, that depends on the individual.
    The Spring documentation is quite large, but Spring itself is very modular. So you can pretty much get away with reading the pieces you need when you need them and ignoring the rest.
    Start with inversion of control until you feel you understand the concept. At its core, the idea is simple. Suppose you have a business class, FooService, and it needs to utilize BarService to implement its business logic. The non-Spring way would be to have the FooService class be responsible for getting an instance of BarService. The Spring way is for FooService to have a setter to be given an instance of BarService:
    public class FooServiceImpl implements FooService
        private BarService barService;
        public void setBarService(BarService barService) { this.barService = barService; }
    }Then the Spring container is used to "wire together" the instances:
    <beans>
        <bean id="barService" class="BarServiceImpl" />
        <bean id="fooService" class="FooServiceImpl">
            <property name="barService" ref="barService" />
        </bean>
    </beans>Note the advantage when using the classes in different contexts, e.g. unit testing vs production.
    If I were you, I would take the sample app you have already done with JSF and try to integrate Spring into it. Move all the business logic into beans in the Spring container while keeping the view logic in the JSF layer.

  • Spring Hibernate ... I am confuse in implementing

    Hi,
    I am creating a project in which i am using hibernate at DB level and spring core for business layer. The db level hibernate project is separate project having all the beans, hibernate cfg file and hbm files. I have run this application independently and it is working fine.
    Now, i have created another web project, in which i am gona include this hibernate project. I want to use Spring to initiate hibernate session and other things. But i am unable to get what mapping should i make in spring file. Using Spring in Action for reference, but again i am stuck.
    My main question is, I want to do hibernate specfic select query, say get users, my hibernate mapping and other stuff is complete in hibernate project, how would i proceed in spring web project?

    JSF is on UI side .. which right now i have not configured :)
    can you recommend some nice spring forum with good amount of users

  • Reg. JSF Spring Integration issue.

    Hi All,
    I am using JSF for the front end and using the Spring Core, DAO and AOP for the BO and DAO layers. When i try to inject the Objects using the DI to the JSF, i am getting the following error and the objects are not getting set from the Spring.
    Error Log:*
    javax.servlet.ServletException: Unable to create managed bean dataUploadControllerBean. The following problems were found:
    - Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
    - Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
    - Bean or property class #{dataUploadVO} for managed bean dataUploadControllerBean cannot be found.
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
    org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
    i have defined the respective entries correctly to integrate the JSF & Spring. But still the JSF&Spreing is not integrated successfully. Please find the configs defined and help to resolve the issue. i am stuck in this for 2 days...
    Web.xml
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>WEB-INF/applicationContext.xml</param-value>
    </context-param>
    Faces-Config.xml
    <application>
    <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> <!-- have used this ELResolver to injects objects from Spring-->
    </application>
    <managed-bean>
    <managed-bean-name>dataUploadControllerBean</managed-bean-name>
    <managed-bean-class>com.sgspace.model.dataupload.DataUploadControllerBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>dataUploadBean</property-name>
    <value>#{dataUploadBean}</value> _<!-- Already present in the faces-config.xml-->_ </managed-property>
    <managed-property>
    <property-name>dataUploadVO</property-name>
    <property-class>#{dataUploadVO}</property-class> _<!-- Injected from Spring DI. This is currently not working.-->_
    <value></value>
    </managed-property>
    <managed-property>
    <property-name>dataUploadBO</property-name>
    <property-class>#{dataUploadBO}</property-class>_<!-- Injected from Spring DI. This is currently not working.-->_ <value></value>
    </managed-property>
    </managed-bean>
    applicationContext.xml:_
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    <bean id="dataUploadDAO"
    class="com.sgspace.dao.dataupload.DataUploadDAOImpl">
    <property name="dataSource" ref="dataSource"></property>
    </bean>
    <bean id="dataUploadBO"
    class="com.sgspace.bo.dataupload.DataUploadBOImpl">
    <property name="dataUploadDAO" ref="dataUploadDAO"></property>
    </bean>
    <bean id="dataUploadVO" class="com.sgspace.vo.dataupload.DataUploadVO"></bean>
    </beans>
    Warm Regards,
    Praveen S

    The TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
    TestBean.java (Backing Bean)
    private DeviceTypeManager deviceManager;
    public DeviceTypeManager getDeviceManager() {
         return deviceManager;
    public void setDeviceManager(DeviceTypeManager deviceManager) {
         this.deviceManager = deviceManager;
    Here are the two scenarios
    Scenario 1 : without <managed-property> the code works fine
    Scenario 2 : with <managed-property> the code results in following error
    javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
    Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
    The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
    Cannot get value for expression '#{test.selectedDevice}'
    I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
    Regards
    Bansi

  • JSF and Hibernate Lazy loading

    Hello,
    It seems like Hibernate session is being closed after exception. This makes a conflict with JSF, since after session is closed lazy initialization cannot take place and the view of the page cannot be rendered.
    Is it right that Hibernate session is closed after exception ?
    How can this problem be treated ?

    Thanks,
    The problem happened since I was making rollback right after the exception. The session is closed after a rollback ...
    I am already using session-per-request (my own implementation). I changed the code to make rollback only once at the end of the filter. If a caught exception happens during request I only register a request for rollback.

  • FDS+Spring+Hibernate

    If any body has worked with FDS /Hibernate/Spring
    pls post the sample.
    regards
    anil

    The posts here that point to examples of Spring + FDS and
    separate examples of Hibernate + FDS and then say combining the two
    should be easy seem to be missing the point. This is not as easy an
    straight forward as it seems it should be.
    Spring + Hibernate + FDS is a completely different animal
    because you are getting Spring to handle the Session Factory
    configuration and your DAO's as Spring beans but you also want the
    handling of lazy initialization and proxy serialization as shown in
    the HibernateAssembler.
    The current HibernateAssembler code handles all of the
    Hibernate setup. I would much rather have Spring do this. What I
    would like is for my HibernateProxy's for non initialized
    associations to be serialized rather than traversed resulting
    LazyInitializationExceptions. The HibernateAssembler seems to
    tackle this with a very mysterious piece of code:
    PropertyProxyRegistry.getRegistry().register(HibernateProxy.class,
    new HibernatePropertyProxy());
    PropertyProxyRegistry and HibernatePropertyProxy are not
    documented anywhere, and in fact a Google on PropertyProxyRegistry
    returns 0 results. However, my intuition tells me this piece of
    code should tell serialization to proxy the HibernateProxy with a
    flex class called HibernatePropertyProxy which will just serialize
    an id of an association rather than attempting to serialize the
    uninitialized associated class.
    I cannot get this to work though and as there is no
    documentation and no discussion on these classes, I have no way of
    verifying it. If my intuition is correct, this is a very useful
    mechanism. I only wish it was documented b/c if it did work as
    expected it would make a Hibernate + Spring + FDS implementation
    pretty easy.
    Anyone know anything about this?

  • How to persist parent  and child tree node data through JSF and Hibernate

    Dear dudes,
    I'm a novice to JSF and Hibernate
    Actually i want to create a tree structure where for each child node, i should have the parent node reference in my form and then when i save, i need to save the corresponding child node data in the database.
    node-1
      node 1-1
         node 1-11a
      node 1-2
    node-2
       node 2-1
       node2-2Whenever i click node 1-1 the corresponding parent node ( node-1) reference should appear in my form and when i save this data this data should be saved under parent node and the tree should be re-rendered.
    How this can be accomplished and if there are any URL's please refer.

    Everybody need not face the same problem you faced. And moreover, everyone out here have their own issues to solve. If people are helping out here, its cause of their passion. Please try to be polite.
    First of all, what is that you have tried on the issue? Could you please share your work so that we can try to fill the gaps?

  • [ANN] JSF/Spring integration solution

    We developed a solution for integrating JSF with the Spring framework (http://www.springframework.org/), a well-designed, extensible and easy-to-use Java framework built around an Inversion of Control container (see http://martinfowler.com/articles/injection.html).
    Our glue code wraps the JSF context into a Spring context and thus merges them. This way, the JSF context becomes part of Spring and vice versa. This is done in a implementation independent way so that it can be used with any JSF implementation.
    For source code, documentation and an example application see http://sourceforge.net/projects/jsf-spring.
    Any comments are greatly appreciated!

    I'm experiencing problem in using the
    jsf-spring-2.4-example sample application. The
    following errors was returned:
    ============================================
    javax.servlet.ServletException:
    javax.servlet.jsp.JspException:
    org.springframework.beans.factory.BeanDefinitionStoreException:
    IOException parsing XML document from resource
    [WEB-INF/faces-config.xml] of ServletContext; nested
    exception is java.net.UnknownHostException:
    java.sun.com
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.showNames_jsp._jspService(showNames_jsp.java:91)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    org.springframework.web.jsf.RequestHandledFilter.doFilter(RequestHandledFilter.java:116)
    ============================================
    As far as I understand, the error was caused by some
    class within the sample application which tries to
    connect to the Internet. When I'm currently connected
    to the Internet which I cannot always do because I'm
    using a prepaid connection, the error suddenly
    disappear. This makes testing of the application
    difficult when constant Internet connection is absent.
    I hope you can shed light to me regarding this matter.
    Thank you very much!

  • JSF & Spring integration

    Hi there,
    i want to integrate spring with my existing application. is there any good tutorials in net to give good view on that. i google it but not fully satisfied.
    please help me if you have any idea..
    Regards,
    A.

    The TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
    TestBean.java (Backing Bean)
    private DeviceTypeManager deviceManager;
    public DeviceTypeManager getDeviceManager() {
         return deviceManager;
    public void setDeviceManager(DeviceTypeManager deviceManager) {
         this.deviceManager = deviceManager;
    Here are the two scenarios
    Scenario 1 : without <managed-property> the code works fine
    Scenario 2 : with <managed-property> the code results in following error
    javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
    Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
    The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
    Cannot get value for expression '#{test.selectedDevice}'
    I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
    Regards
    Bansi

  • JSF/Spring integration - managed-property problem

    I am using JSF 1.1_01 (MyFaces 1.1), Spring 1.2, Ajax4Jsf.
    The JSF application has h:selectOneMenu .
    On change event of h:selectOneMenu sets "selectedValue" into backing bean as shown below:
    page.jsp
    <h:selectOneMenu value="#{test.selectedDevice}" >
    <f:selectItem itemValue="0" itemLabel="--New--"/>
    <f:selectItem itemValue="1" itemLabel="WorkStation"/>
    <f:selectItem itemValue="2" itemLabel="Router"/>
    <f:selectItem itemValue="3" itemLabel="Switch"/>
    <ajax:support action="#{test.loadDevice}" event="onchange" reRender="t2,t3,t4,t5"/>
    </h:selectOneMenu>
    TestBean.java (Backing Bean)
    public String getSelectedDevice() {
    logger.info(" *** In getSelectedDevice *** ");
    if (selectedDevice == null) {
    selectedDevice = "0"; // This will be the default selected item.
    return selectedDevice;
    public void setSelectedDevice(String selectedDevice) {
    logger.info(" *** In setSelectedDevice *** ");
    this.selectedDevice = selectedDevice;
    Here are the configuration file snippets for integrating JSF Spring
    web.xml
    <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    faces-config.xml
    <application>
    <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
    </application>
    <managed-bean>
    <managed-bean-name>test</managed-bean-name>
    <managed-bean-class>test.TestBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>deviceManager</property-name>
    <property-class> test.DeviceTypeManager </property-class>
    <value>#{deviceManager}</value>
    </managed-property>
    </managed-bean>
    The above code results in the following error
    javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
    The error occurs only if i include <managed-property> inside the <managed-bean> in faces-config.xml.
    The moment i remove <managed-property> from face-config.xml the error disappears & page gets rendered properly.
    The purpose in having <managed-property> inside managed-bean is to call Spring's Manager class (i.e. deviceManager) from JSF application
    Any pointers/suggestions in resolving the error will be highly appreciated
    Regards
    Bansi

    The TestBean have a property for DeviceManager along with setter/getter methods as shown below. Sorry for not including in earlier posting
    TestBean.java (Backing Bean)
    private DeviceTypeManager deviceManager;
    public DeviceTypeManager getDeviceManager() {
         return deviceManager;
    public void setDeviceManager(DeviceTypeManager deviceManager) {
         this.deviceManager = deviceManager;
    Here are the two scenarios
    Scenario 1 : without <managed-property> the code works fine
    Scenario 2 : with <managed-property> the code results in following error
    javax.faces.FacesException: Cannot get value for expression '#{test.selectedDevice}'
    Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration
    The Scenario 1 works absolutely fine as the expression '#{test.selectedDevice}' gets its value from setter/getter method in the backing bean(TestBean.java) . This is expected behaviour & wondering why it doesn't work similarly in Scenario 2 instead it complains
    Cannot get value for expression '#{test.selectedDevice}'
    I am willing to upload the war file. Any pointers/suggestions in resolving the error will be highly appreciated
    Regards
    Bansi

  • A beginner to design pattern(Struct,Spring & Hibernate framework)

    Actually I am beginner to MVC2 Approach of complex application incorporated by design pattern as Struct,Spring & Hibernate framework.
    Currently I am learning JSP Concepts,I have one doubt.
    (1)What are the things I should grasp even before taking off to Design pattern?
    Help me anyone plz?
    With Regards,
    Stalin.G

    [email protected] wrote:
    Actually I am beginner to MVC2 Approach of complex application incorporated by design pattern as Struct,Spring & Hibernate framework.
    Currently I am learning JSP Concepts,I have one doubt.Just one?
    >
    (1)What are the things I should grasp even before taking off to Design pattern?You should understand core Java very, very well.
    You should know JSPs using JSTL without scriptlets.
    You should understand relational databases and SQL.
    You should understand HTML and HTTP.
    Personally I think Struts, Spring, and Hibernate all at once are well beyond any beginner.
    It's hard to advise you on what to do without knowing your capabilities and the problem you're trying to solve, but I think you should try it first using just JSPs, servlets, and JDBC. Get that to work and then refactor it to use the frameworks. You'll understand and appreciate them more that way.
    %

Maybe you are looking for

  • Multiple Subject Areas

    Somewhat new so please forgive me if the question is simple (if it is, please point me in the right direction). I've looked through the documentation and this forum, but have not found what I'm looking for yet. I am trying to get a single worksheet t

  • Internet Explorer 11 Failing Acid3 Test 63/100

    Contrary to claims on Wikipedia that IE11 passes Acid3 with 100/100, I only scored a 63/100 with my IE11 with a 'FAIL' above the shadowey logo. (I can't put a picture until my account is verified.)  https://social.technet.microsoft.com/Forums/getfile

  • Where is possible to get j2sdk-1_4_2_02-linux-i586.bin ?

    Dear community, where is possible to get j2sdk-1_4_2_02-linux-i586.bin ? i need to install jre on FreeBSD from ports, so needed this binary. Thank you.

  • Asha 306 Not enough bandwidth

    When I try to stream you tube videos a message displays saying Not enough bandwidth, then operation failed. How can I rectify this?

  • Websites -HTTP/HTTPS/FTPS, no DMZ

    Hello everyone, I'm having some trouble and need your assistance. We have thirty five HTTP/HTTPS/FTPS web sites to setup in the ASA 5520 ASDM firewall, we need to know if its possible to have them all setup  without using a DMZ, we have two or three