1 Reply Latest reply on Feb 25, 2010 8:14 AM by Samuel Doyle

    Jsf seam session

    aby b Newbie
      i got one problem regarding jsf seam session , can you please look into this , i am very new to this topic , could you be able to help me , below is my bean


      package com.gms_v6.model;

      import java.util.Date;
      import java.util.HashSet;
      import java.util.Set;
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.FetchType;
      import javax.persistence.GeneratedValue;
      import javax.persistence.Id;
      import javax.persistence.JoinColumn;
      import javax.persistence.ManyToOne;
      import javax.persistence.OneToMany;
      import javax.persistence.Table;
      import javax.persistence.Temporal;
      import javax.persistence.TemporalType;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;
      import javax.servlet.http.HttpSession;
      import javax.faces.context.FacesContext;

      @Entity
      public class PatHeader implements java.io.Serializable {

      /*       FacesContext fCtx;
              HttpSession session;*/
         

      private Integer patId;  /* auto incremented in database */
      private String patFirstName;
      private String patMiddleName;


      public PatHeader() {
      }




      @Id
      @GeneratedValue
      @Column()
      public Integer getPatId() {
                /*
                      fCtx = FacesContext.getCurrentInstance();
                      session = (HttpSession) fCtx.getExternalContext().getSession(false);
                      session.setAttribute("patId", patId);
                      System.out.print(" patId >>>>>>>>> : "+patId);*/
        return this.patId;
      }
      public void setPatId(Integer patId) {
                      System.out.print(" patId >>>>>>>>> : "+patId);
        this.patId = patId;
      }




      @Column()
      public String getPatFirstName() {
        return this.patFirstName;
      }
      public void setPatFirstName(String patFirstName) {
        this.patFirstName = patFirstName;
      }



      @Column()
      public String getPatMiddleName() {
        return this.patMiddleName;
      }
      public void setPatMiddleName(String patMiddleName) {
        this.patMiddleName = patMiddleName;
      }



        in the above java class i want put only " patId " into session not other variables how can i do this in jsf seam framework ,
      How will i access this session value in another bean
      i am using netbeans IDE



      any help will be great



      "[My Link=>""]"

      ++++

        • 1. Re: Jsf seam session
          Samuel Doyle Apprentice

          Dude, that's a bit scary heh, you probably want to be using your Seam managed components to be creating those entities and persisting them or in a case like this creating them in your JSF pages directly.


          Look at the registration example that comes with Seam it looks like what you are looking for.