Hi wicketers,

I would like to ask you what's the best way to perform the following:
Say I have Products. There are Products that have a Photo and there are 
Products that don't.

        // Set data to the page
        add(new Label("product-description", product.getDescription()));
        
        if (product.getPhoto() != null) {
            add(new Label("product-photo-date", 
CommonUtil.getFormattedDate(product.getPhoto().getDateTime())));
            add(new Label("product-photo-time", 
CommonUtil.getFormattedTime(product.getPhoto().getDateTime())));
        }

In my html i have 

<span wicket:id="product-description">[product-description]</span>
(eventually add something here)
<span wicket:id="product-photo-date">[product-photo-date]</span>
<span wicket:id="product-photo-time">[product-photo-time]</span>
(eventually add something here)

And Wicket will complain if product.getPhoto() is null, of course, cause 
product-photo-date and product-photo-time were never added to the page 
component.

I really don't see how to avoid this check, or how to solve this elegantly. 
Perhaps missing something obvious, hope not :)

And afaik the useComponentUseCheck setting at application level checks the 
other way round (if elements declared in java Page are marked-up in html code). 
Anyway, I have it set to false.

Thanks in advance, and thanks as well for such a nice web framework,

Francisco




        

        
                
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son 
interface révolutionnaire.
http://fr.mail.yahoo.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to