This content has been marked as final.
Show 2 replies
-
1. Re: referencing different objects in datagrid
thejavafreak Sep 11, 2008 2:51 AM (in response to piotrjanik)Give us a look on how your Action class look like for displaying this xhtml page.
-
2. Re: referencing different objects in datagrid
piotrjanik Sep 11, 2008 11:40 AM (in response to piotrjanik)@Stateful @Name(value = "productShow") @Scope(value = ScopeType.SESSION) public class ProductShow implements ProductShowLocal { private Product product; public Product getProduct() { return product; } ... some other properties
and productVariant
@Name(value = "productVariant") @Entity @Scope(value = ScopeType.EVENT) public class ProductVariant { @Id @GeneratedValue int id; @Column(name = "name") public String name; @OneToMany(cascade = CascadeType.ALL, mappedBy = "variant") public Collection<ProductVariantOption> options; @ManyToOne Product product;
Mentioned page displays product information(Product object).
Product has a collection of variants(ProductVariant) and every variant has a collection of values/options(ProductVariantOption).JSF renders page with datagrid for variants, so every variant has its own rich:panel.
Every rich:panel has its own h:inputText with commandButton to add new option.
Problem: value of above h:inputText is the same for every rich:panel.One of solutions would be linking OPTION_STRING on client side, as below:
<h:inputText id="OPTION_STRING"/> <h:commandButton value="Dodaj" action="#{variant.AddOption(OPTION_STRING)}"/>
Thanks and sorry for my english!
Peter