Can't you return Collections.EMPTY_LIST.iterator() from the dataprovider
when an exception happens
and also set the visibility of the data view based on the size -
dataview.setVisible(yourdataprovider.size()>0)
Regards
Dipu
On 8/9/07, Johan Maasing <[EMAIL PROTECTED]> wrote:
>
> I am rather new to wicket, coming from a Tapestry angle. Anyway, my
> question is rather basic.
> I gather that all components on a page must be rendered?
> Suppose I have a common dataview with a dataprovider on a page, basic
> CRUD-stuff. My page constructor looks like this:
>
> try {
> ...query the database and build the provider and dataview
> } catch (SQLException e) {
> feedback.error("Very bad things happened");
> // What to do here??
> }
>
> What is the best practice for removing/disabling components in the
> catch clause? I can not create the dataview (called "dataview" in the
> HTML) since the backend has died but wicket needs a component there?
>
> Currently I do somehting like this
>
> } catch (Exception e) {
> add(new Label("dataview", "").setVisible(false));
> }
>
> and that works fine but it seems a bit un-DRY to have to add dummy
> components for the error case. Is my understanding correct?
>
> Cheers,
> /Johan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>