Note that there are some explanatory texts on larger screens.

plurals
  1. POloop through an attribute from a javabean
    primarykey
    data
    text
    <p>I want to print all my products in a table on a JavaServer page but I have troubles with my jstl code.</p> <p>My Model product:</p> <pre><code>public final class Product { private int id; private String description; private Double price; private String categoryName; ... </code></pre> <p>My JavaBean products: (when this bean is created it's filled with products from my model)</p> <pre><code>@ManagedBean(name = "productsBean") @RequestScoped public class Products implements Serializable { private List&lt;Product&gt; producten; @ManagedProperty(value = "#{applicationBean}") private ApplicationBean applicationBean; public Producten() { Store store = applicationBean.getStore(); for (String c : store.getCategories()) { for(model.Product p : store.getProductsOfCategory(c)){ beans.Product product = new Product(); product.setId(p.getId()); product.setDescription(p.getDescription()); product.setCategoryName(p.getCategoryName()); product.setPrice(p.getPrice()); producten.add(product); } } } </code></pre> <p>My JavaBean Product:</p> <pre><code>@ManagedBean(name= "productBean") @RequestScoped public class Product implements Serializable{ @ManagedProperty(value = "#{applicationBean}") private ApplicationBean applicationBean; private int product_id; private String description; private Double price; private String categoryName; </code></pre> <p>In my JavaServer Page I want something like that but:</p> <pre><code> &lt;c:forEach var="product" items="${productsBean.products}"&gt; &lt;tr&gt; &lt;td&gt;${product.description}&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload