• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

p:selectCheckboxMenu diplay 2 List Pojo

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello I have a problem in the composente Primefaces I use 2 class entity (EJB3 JPA), Class Customer (id, Firstname, Lastname, List listPhone) and class phone (Id, number, type) in ManagerBeans I did in the method of the page to initialized a inite () method that loads a list of all the phone in the phone list in a table and load a list of phone aure each client the objective of this consignment of two list is to check if a value in both repeat list for up to the user of the application is to appear in the phone and selectCheckboxMenu dejat assoicrer a customer and other did not not check in, please help me here is the runs code.

in the base to give it in the Phone table 3 phone there's Register, alor must appear in the image box 2 by 3 phone that already has a sales associate and the 3rd is check pa, but the three nd it is not playing. !
<h:form>
<p:selectCheckboxMenu value="#{customerBeansController2.phones}" label="Phone">
<f:selectItems value="#{customerBeansController2.c2.phoneNumbers}" var="c" itemValue="#{c}" itemLabel="#{c}" />
</p:selectCheckboxMenu >
@Entity
public class Customer implements java.io.Serializable {

@Id
private Integer id;
@Column(name = "firstName")
private String firstName;
@Column(name = "lastName")
private String lastName;
@OneToMany(fetch=FetchType.EAGER)
private List<Phone> phoneNumbers = new ArrayList<>(); public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
} public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}


public List<Phone> getPhoneNumbers() {
return phoneNumbers;
}

public void setPhoneNumbers(List<Phone> phoneNumbers) {
this.phoneNumbers = phoneNumbers;
}

public Customer(Integer id, String firstName, String lastName, List<Phone> phoneNumbers) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumbers = phoneNumbers;
}




public Customer() {
}

@Override
public int hashCode() {
int hash = 5;
return hash;
}

@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Customer other = (Customer) obj;
return true;
}

@Override
public String toString() {
return "Customer{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", phoneNumbers=" + phoneNumbers + '}';
}

} Managerbeans private List<Customer> customers = new ArrayList<>(); private List<Phone> phones = new ArrayList<>(); private Customer c2;
@PostConstruct
public void init() {

customers = customerFacade.findAll();


this.c2=customerFacade.find(1);

phones = phoneFacade.findAll();


} <h:form>
<p:selectCheckboxMenu value="#{customerBeansController2.phones}" label="Phone">

<f:selectItems value="#{customerBeansController2.c2.phoneNumbers}" var="c" itemValue="#{c}" itemLabel="#{c}" />
</p:selectCheckboxMenu >
</h:form> @Entity
public class Phone implements java.io.Serializable { private static final long serialVersionUID = 1L; @Id
private Integer id ; @Column(name="number")
private String number;
@Column(name="type")
private Integer type;


----------
public Phone( ) {}

public Phone(Integer id ,String number, Integer type) {
this.id=id;
this.number = number;
this.type = type;
}


----------
public Integer getId( ) { return id; }
public void setId(Integer id) { this.id = id; }

public String getNumber( ) { return number; }
public void setNumber(String number) { this.number = number; }

public Integer getType() {
return type;
}

public void setType(Integer type) {
this.type = type;
}

@Override
public int hashCode() {
int hash = 7;
return hash;
}

@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Phone other = (Phone) obj;
return true;
}

@Override
public String toString() {
return "Phone{" + "id=" + id + ", number=" + number + ", type=" + type + '}';
}

checkboxmenu.png
[Thumbnail for checkboxmenu.png]
image p:selectCheckboxMenu
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic