Bug PrimeFaces Or JSF help me

UI Components for JSF
Post Reply
77713777
Posts: 17
Joined: 14 Jul 2010, 21:28
Location: Brasil
Contact:

16 Sep 2010, 17:30

Hi everyone, I believe I have a difficult problem to be solved!

Let me describe the context, is complex ...
I have an abstract class that all my manageBean (Controller) implement.
description of this class, it has several methods and variables that are used in controls.
Perfect ...
go to the scene, has a controller associated with a view, this control uses two controller objects instantiated directly (new Controler1 (), new Controler2), internal variables of the object controller.
both extends the abstract class.
One of the variables that have in this class is abstract pages, - number of pages that represent the controller of that ...- Beans
Controller associated with the view .. <p:dialog> which has two lists of objects (page 1 of n pages).
The two have <p:dialog> object1 and objeto2 respectively of their controls instantiated directly ...
ok perfect. first impressions of the p: dialog ok, without changing the page ... presented here is 4 and 7 respectively objects page ...

Very well at the event return to the page, eg page 3 of the request Controler2 ... and this has objeto2 4 pages of Bean objects .... while object1 has 7 ...
Now comes the problem and it assumes object1 objeto2 has 4 pages ... What is the variable pages of private abstract class ...

then to be sure of what I'm talking about a test I put (I copied it created) this variable in each object1 ... objeto2 .... surprise ... hahahha correct value ...

Does anyone have any tips! ...
I'm doing this wrong?
If you were to implement as solve such a problem?

artur.jackowski
Posts: 30
Joined: 14 Sep 2010, 19:00

17 Sep 2010, 01:43

Sorry, but I can't understand what you are trying to say.

best regards,
artur

77713777
Posts: 17
Joined: 14 Jul 2010, 21:28
Location: Brasil
Contact:

17 Sep 2010, 02:21

I'm have one abstract class , this class has many methods and variables ok!
Im using this class in always the manageBean...

Now have One Object, this object has many variables among which. 2 object manageBean accessed directly
see code, exemplify best

Code: Select all

public abstract class AllBeans
{
     Integer pages []={}; // array of pages showing 
     
      // other variables and methods 
     public Integer[]  getPages()
     {
        return pages; // number of pages has in database of this object
     }

     public void setPages(Integer arrayPage[])
    {
       pages=arrayPages;
    }
     .
     .
     .
}
now have one Object extends this class...

Code: Select all

@ManagedBean(name = "managebean1 ")
@ViewScoped
public class ManageBean1 extendes AllBeans implemetes Serializable
{
    Bean1 bean1;
    String str1;
    public ManageBean1 ()
    {
       if(bean1==null)
       {
              bean1= new Bean1();
              str1= new String();
         }
   }
   // methods gets and sets
  public List<Bean1>   processList()
  {
     //assuming that this list is 4 pages of objects
     this.setPages(new Integer[]{1,2, 3, 4}); //  example code
     return // list of de the Bean1;
  }
}

the seconde controller

Code: Select all

@ManagedBean(name = "managebean2 ")
@ViewScoped
public class ManageBean2 extendes AllBeans implemetes Serializable
{
    Bean1 bean2;
    String str2;
    public ManageBean2 ()
    {
       if(bean2==null)
       {
              bean2= new Bean2();
              str2= new String();
         }
   }
   // methods gets and sets
  public List<Bean2>   processList()
  {
     //assuming that this list is 7 pages of objects
     this.setPages(new Integer[]{1,2, 3, 4, 5, 6, 7}); //  example code
     return // list of de the Bean2;
  }
}
Finally the third manageBean

Code: Select all

@ManagedBean(name = "managebean3 ")
@ViewScoped
public class ManageBean3 extendes AllBeans implemetes Serializable
{
    Bean1 bean2;
    String str2;
    ManageBean1  manage1;
    ManageBean2  manage2;
    public ManageBean2 ()
    {
       if(bean2==null)
       {
              bean2= new Bean2();
              str2= new String();
              manage1=  new ManageBean1();
              manage2=  new ManageBean2();
         }
   }
   // methods gets and sets
  public List<Bean2>   processList()
  {
     
     return // list of de the Bean3;
  }
}
Im my view i'm printing in <p:dialog id="p1"> and <p:dialog id="p2"> ok....
ok.. let's part of code view....

Code: Select all

<p:dialog id="p1" widgetVar="panel1">
<h:dataTable var="listLinksBea1" rows="7" value="#{managebean3 .manage1.pages }">
      <p:column>
        <p:commandLink id="lastDglLinksBea1" rendered="#{managebean3 .manage1.currentPage != listLinksBea1}"   action="#{managebean3.manage1.processList}" >
                      <h:outputLabel> #{listLinksBea1}</h:outputLabel>   
        </p:commandLink>
        <h:outputText rendered="#{managebean3 .manage1.currentPage == listLinksBea1}">#{listLinksBea1} </h:outputText>
      </p:column>
</h:dataTable>
</p:dialog>
code of the second p:dialog

Code: Select all

<p:dialog id="p2" widgetVar="panel2" >
<h:dataTable var="listLinksBea2" rows="7" value="#{managebean3 .manage2.pages }">
      <p:column>
        <p:commandLink id="lastDglLinksBea2" rendered="#{managebean3 .manage2.currentPage != listLinksBea2}"   action="#{managebean3 .manage2.processList}" >
                      <h:outputLabel> #{listLinksBea2}</h:outputLabel>   
        </p:commandLink>
        <h:outputText rendered="#{managebean3 .manage2.currentPage == listLinksBea2}">#{listLinksBea2} </h:outputText>
      </p:column>
</h:dataTable>
</p:dialog>
Ok... let's the first test.. showing our p:dialog => result ok... number correct of pages...
click first one afer two again in one.... see results corrects at now...
From that moment click em panel2 again and click, for example in number 4... ok... not wrong...
at now click panel1, suprise... my palel1 has 7 pages.... wrong result.... because the controler find 4 pages of object Bean1...

At now how do I fix this?
I'm thing bug of primeFaces or JSF what talk me about this?

may contain errors in that code, as did direct the forum,
only to help you understand the my problem, I'm also pretty puny in English
Last edited by 77713777 on 17 Sep 2010, 03:33, edited 1 time in total.

artur.jackowski
Posts: 30
Joined: 14 Sep 2010, 19:00

17 Sep 2010, 02:55

Ok, you have one main abstract class. All your managed beans inherits from that abstract class and also belong to that class (as parameters access via get/set or they are on some kind of list/table).
Is it correct?
What else?


best regards,
artur

77713777
Posts: 17
Joined: 14 Jul 2010, 21:28
Location: Brasil
Contact:

17 Sep 2010, 03:36

Anybody can help me?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 60 guests