For some reason the panel isn't rendering when using it in velocity way:
> Products listing
>
> New Product, 5
> $productPanel.product($p) 1001 , 1000 , 1003 , 1004 , 1002
> $productPanel.product($p) 1001 , 1000 , 1003 , 1004 , 1002
>
The ProductPanel source:
> /**
> * Provides a custom product Panel.
> */
> public class ProductPanel extends Panel {
>
> private static final long serialVersionUID = 1L;
>
> public ProductPanel(String name, Product p) {
> setName(name);
> getModel().put("product", p);
> }
> public ProductPanel(String name) { setName(name);}
> public void setProduct(Product p) {getModel().put("product", p);}
> public Product getProduct() {return (Product)
> getModel().get("product");
> }
> }
>
The ProductPanel template:
> <div class="product">
> 3.jpg
> $product.name, $product.price
> </div>
>
In the ProductsPage we are using it:
> // Constructor
> ------------------------------------------------------------
> public ProductsPage() {
> //Page's title
> super("Products listing");
> //add the custom product panel to the page
> addControl(productPanel);
> productPanel.setProduct(new Product("New Product", 5, "A great
> product"));
>
> //add the product's list to the page model
> addModel("products", Service.getProducts());
> }
>
The products htm file:
> $productPanel
> <table>
> #foreach( $p in $products )
> <tr>
> <td>$productPanel.product($p)</td>
> <td class="categories">
> #foreach( $c in $p.categories )
> #if ($foreach.count>1),#end $c.name#end
> </td>
> </tr>
> #end
> </table>
>
Can't I use a component in Velocity template?
Regards,
Gilberto
gilbertoca wrote:
>
> Hi,
>
> After read this[1] post about how to benchmark the response time and
> the rendering engine of some component based frameworks, I felt
> comfortable to try it with Apache Click. The example used by the
> author's post uses a panel or other artifact provided by the framework
> to create a reusable component.
> This one[2] is my first try and I've used the filterPanel[3] as
> sample, but I think I've missed something on the model setup because
> the the new panel (ProductPanel) has not been rendered.
>
> Can someone take time to look at in the source and provide some
> feedback before I send it to the post's author to publish it?
>
>
> Regards,
>
> [1] http://www.jtict.com/blog/rails-wicket-grails-play-lift-jsp/
> [2] http://dl.dropbox.com/u/9093640/clickapp.zip
> [3] http://click.avoka.com/click-examples/panel/filter-panel-demo.htm
>
> Gilberto Caetano de Andrade
> www.secad.to.gov.br
> blog.gilbertoca.com
>
--
View this message in context:
http://click.1134972.n2.nabble.com/Rails-Wicket-Grails-Play-Tapestry-Lift-JSP-Context-and-Click-tp6711340p6712533.html
Sent from the click-user mailing list archive at Nabble.com.