[ 
https://issues.apache.org/jira/browse/WICKET-4007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeremy Thomerson closed WICKET-4007.
------------------------------------

    Resolution: Won't Fix

I agree with the commenters here.  This isn't the "Wicket way".  It may seem 
good at the surface.  But it's overly simplistic.  It only works with strings.  
What if you want to show a currency amount (think shopping cart total) several 
places on the page?  Well, putVariable("cartTotal", someTotal).  Oh, but now 
you need a way to convert that to a proper currency string, not just a normal 
double.  So, now we need to shoehorn in a way to convert values.  Next, you 
need to not show it if there's nothing in the cart.  Well, let's shoehorn that 
in.

Wicket works with components.  This isn't a component.

All that being said, it's SUPER easy for you to add this functionality to your 
own base page.  You just need a component resolver to resolve your wicket:var 
tag.  Then, in your base page you can store a map of variables, add a 
putVariable method and your resolved auto-added components can 
getPage().getMyMagicMap().get(myNameAttrValue);  *That's* the beauty of Wicket. 
 You could add this feature yourself in fifteen minutes.

> New tag wicket:var
> ------------------
>
>                 Key: WICKET-4007
>                 URL: https://issues.apache.org/jira/browse/WICKET-4007
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket
>            Reporter: Bruno Borges
>              Labels: tag,, variable, wicket,
>         Attachments: wicket-var-feature.diff
>
>
> This will facilitate users to reference models in several places of the 
> markup.
> One can do: 
> class Page extends WebPage {
>   public Page() {
>     putVariable("username", "Peter Johnson");
>   }
> }
> <html>
> <body>
>   <div class="header">
>     <wicket:var name="name" />
>   </div>
>   <div class="container">
>     <wicket:var name="name" />
>   </div>
>   <div class="footer">
>     <wicket:var name="name" />
>   </div>
> </body>
> </html>
> It will be possible too to do such a thing:
>   Java:  putVariable("css", "blue-header");
>   HTML:   <div wicket:var="class:css">
> And render: <div class="blue-header">
> These variables can be rendered multiple times and my also be accessed from 
> child objects (but not the opposite), like:
>   add(new WebMarkupContainer("header"));
> <div wicket:id="header">
>   <span wicket:var="class:css">Header</span>
> </div>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to