You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dmitriy Neretin <dm...@googlemail.com> on 2013/02/01 14:12:56 UTC

Problem with markup inheritance in Wicket 6

Hi Folks,

I have another problem during Wicket 6 migration. This time it is a problem
with markup inheritance.

I have an old wicket panel and appropriate markup file:
MyOldGoodWicketPanel & MyOldGoodWicketPanel.html

Markup file looks like this:

<wicket:panel>
 ... stuff ...
</wicket:panel>

Some months ago I needed for the same Panel another Markup, so what I did:

class MyNewPanel extends MyOldGoodWicketPanel {
    almost the same stuff
}

and an appropriate markup file:

MyNewPanel.html with following markup:

<wicket:panel>
 ... other stuff ...
</wicket:panel>

It worked pretty well in the Wicket 1.5, but now I get Exceptions, that the
components from the super class (MyOldGoodWicketPanel) are not found in the
subclass/ in the markup file of the sublclass...

Can somebody explain me what happened?

Regards,
Dmitriy

Re: Problem with markup inheritance in Wicket 6

Posted by Martijn Dashorst <ma...@gmail.com>.
On Tue, Feb 5, 2013 at 10:05 AM, Marios Skounakis <ms...@gmail.com> wrote:
> Understood. I am still unclear why wicket would behave differently in
> deployment and development configuration with respect to missing components
> in the markup. Is there any actual use case for this? If not, I believe it
> would be better to have a consistent behavior.

The check costs CPU time. The check is there for developers to detect
missing stuff/errors. We detect them during the DEVELOPMENT phase. As
long as Wicket is able to function correctly and render pages without
problems, there is IMO no problem with letting your users be able to
use the application in production.

There is a reason why we ship Wicket out of the box with DEVELOPMENT
mode enabled: because developers are our primary audience. As a
developer it is your responsibility to use the framework as intended.
This working is actually well documented in Wicket in Action and the
various talks I gave around the world.

> Of course, changing the way deployment configuration behaves currently
> could break working apps who are now functional because an exception is not
> being thrown...

And that would be a bad thing, since some developers actually depend
on this to work like this (don't ask me why though).

Martijn

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with markup inheritance in Wicket 6

Posted by Marios Skounakis <ms...@gmail.com>.
Understood. I am still unclear why wicket would behave differently in
deployment and development configuration with respect to missing components
in the markup. Is there any actual use case for this? If not, I believe it
would be better to have a consistent behavior.

Of course, changing the way deployment configuration behaves currently
could break working apps who are now functional because an exception is not
being thrown...



On Mon, Feb 4, 2013 at 9:50 PM, Paul Bors <pa...@bors.ws> wrote:

> If your web.xml specifies configuration=deployment and you want to report
> the runtime error on a custom page then in your Application class:
>
> protected void init() {
>   ...
>   getApplicationSettings().setInternalErrorPage(MyInternalErrorPage.class);
>   ...
> }
>
> class MyInternalErrorPage extend WebPage {
>   public MyInternalErrorPage() {
>     Session.get().error("Some custom generic error");
>     throw new RestartResponseException( Application.get().getHomePage() );
>   }
> }
>
> Also, do you have <wicket:extend /> in your parent HTML file and
> <wicket:child> in your extended markup file?
>
> https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-Elementwicket%253Aextend
> https://cwiki.apache.org/WICKET/markup-inheritance.html
>
> But if this was working for you in 5.x then I presume you do have the
> markup inheritence setup right.
>
> ~ Thank you,
>    Paul Bors
> On Sat, Feb 2, 2013 at 3:52 PM, Marios Skounakis <ms...@gmail.com> wrote:
>
> > I've seen this happen too. It's not related to inheritance. If you add a
> > component in code and omit it in the html file, you get different
> behavior
> > in the following cases:
> >
> > - if your web.xml specifies configuration=deployment, you don't get an
> > error
> > - if you web.xml specifies configuration=development, you get a runtime
> > exception
> >
> >
> > On Fri, Feb 1, 2013 at 3:29 PM, Martin Grigorov <mgrigorov@apache.org
> > >wrote:
> >
> > > Hi,
> > >
> > > I think there are no changes in this area.
> > > Do you extend/inherit the markup or completely override it ?
> > > I expect to see <wicket:extend> instead of <wicket:panel> in
> > > MyNewPanel.html.
> > > Create a quickstart and attach it to a ticket in Jira please.
> > >
> > >
> > > On Fri, Feb 1, 2013 at 2:12 PM, Dmitriy Neretin <
> > > dmitriy.neretin@googlemail.com> wrote:
> > >
> > > > Hi Folks,
> > > >
> > > > I have another problem during Wicket 6 migration. This time it is a
> > > problem
> > > > with markup inheritance.
> > > >
> > > > I have an old wicket panel and appropriate markup file:
> > > > MyOldGoodWicketPanel & MyOldGoodWicketPanel.html
> > > >
> > > > Markup file looks like this:
> > > >
> > > > <wicket:panel>
> > > >  ... stuff ...
> > > > </wicket:panel>
> > > >
> > > > Some months ago I needed for the same Panel another Markup, so what I
> > > did:
> > > >
> > > > class MyNewPanel extends MyOldGoodWicketPanel {
> > > >     almost the same stuff
> > > > }
> > > >
> > > > and an appropriate markup file:
> > > >
> > > > MyNewPanel.html with following markup:
> > > >
> > > > <wicket:panel>
> > > >  ... other stuff ...
> > > > </wicket:panel>
> > > >
> > > > It worked pretty well in the Wicket 1.5, but now I get Exceptions,
> that
> > > the
> > > > components from the super class (MyOldGoodWicketPanel) are not found
> in
> > > the
> > > > subclass/ in the markup file of the sublclass...
> > > >
> > > > Can somebody explain me what happened?
> > > >
> > > > Regards,
> > > > Dmitriy
> > > >
> > >
> > >
> > >
> > > --
> > > Martin Grigorov
> > > jWeekend
> > > Training, Consulting, Development
> > > http://jWeekend.com <http://jweekend.com/>
> > >
> >
>

Re: Problem with markup inheritance in Wicket 6

Posted by Paul Bors <pa...@bors.ws>.
If your web.xml specifies configuration=deployment and you want to report
the runtime error on a custom page then in your Application class:

protected void init() {
  ...
  getApplicationSettings().setInternalErrorPage(MyInternalErrorPage.class);
  ...
}

class MyInternalErrorPage extend WebPage {
  public MyInternalErrorPage() {
    Session.get().error("Some custom generic error");
    throw new RestartResponseException( Application.get().getHomePage() );
  }
}

Also, do you have <wicket:extend /> in your parent HTML file and
<wicket:child> in your extended markup file?
https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-Elementwicket%253Aextend
https://cwiki.apache.org/WICKET/markup-inheritance.html

But if this was working for you in 5.x then I presume you do have the
markup inheritence setup right.

~ Thank you,
   Paul Bors
On Sat, Feb 2, 2013 at 3:52 PM, Marios Skounakis <ms...@gmail.com> wrote:

> I've seen this happen too. It's not related to inheritance. If you add a
> component in code and omit it in the html file, you get different behavior
> in the following cases:
>
> - if your web.xml specifies configuration=deployment, you don't get an
> error
> - if you web.xml specifies configuration=development, you get a runtime
> exception
>
>
> On Fri, Feb 1, 2013 at 3:29 PM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > Hi,
> >
> > I think there are no changes in this area.
> > Do you extend/inherit the markup or completely override it ?
> > I expect to see <wicket:extend> instead of <wicket:panel> in
> > MyNewPanel.html.
> > Create a quickstart and attach it to a ticket in Jira please.
> >
> >
> > On Fri, Feb 1, 2013 at 2:12 PM, Dmitriy Neretin <
> > dmitriy.neretin@googlemail.com> wrote:
> >
> > > Hi Folks,
> > >
> > > I have another problem during Wicket 6 migration. This time it is a
> > problem
> > > with markup inheritance.
> > >
> > > I have an old wicket panel and appropriate markup file:
> > > MyOldGoodWicketPanel & MyOldGoodWicketPanel.html
> > >
> > > Markup file looks like this:
> > >
> > > <wicket:panel>
> > >  ... stuff ...
> > > </wicket:panel>
> > >
> > > Some months ago I needed for the same Panel another Markup, so what I
> > did:
> > >
> > > class MyNewPanel extends MyOldGoodWicketPanel {
> > >     almost the same stuff
> > > }
> > >
> > > and an appropriate markup file:
> > >
> > > MyNewPanel.html with following markup:
> > >
> > > <wicket:panel>
> > >  ... other stuff ...
> > > </wicket:panel>
> > >
> > > It worked pretty well in the Wicket 1.5, but now I get Exceptions, that
> > the
> > > components from the super class (MyOldGoodWicketPanel) are not found in
> > the
> > > subclass/ in the markup file of the sublclass...
> > >
> > > Can somebody explain me what happened?
> > >
> > > Regards,
> > > Dmitriy
> > >
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
> >
>

Re: Problem with markup inheritance in Wicket 6

Posted by Marios Skounakis <ms...@gmail.com>.
I've seen this happen too. It's not related to inheritance. If you add a
component in code and omit it in the html file, you get different behavior
in the following cases:

- if your web.xml specifies configuration=deployment, you don't get an error
- if you web.xml specifies configuration=development, you get a runtime
exception


On Fri, Feb 1, 2013 at 3:29 PM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
> I think there are no changes in this area.
> Do you extend/inherit the markup or completely override it ?
> I expect to see <wicket:extend> instead of <wicket:panel> in
> MyNewPanel.html.
> Create a quickstart and attach it to a ticket in Jira please.
>
>
> On Fri, Feb 1, 2013 at 2:12 PM, Dmitriy Neretin <
> dmitriy.neretin@googlemail.com> wrote:
>
> > Hi Folks,
> >
> > I have another problem during Wicket 6 migration. This time it is a
> problem
> > with markup inheritance.
> >
> > I have an old wicket panel and appropriate markup file:
> > MyOldGoodWicketPanel & MyOldGoodWicketPanel.html
> >
> > Markup file looks like this:
> >
> > <wicket:panel>
> >  ... stuff ...
> > </wicket:panel>
> >
> > Some months ago I needed for the same Panel another Markup, so what I
> did:
> >
> > class MyNewPanel extends MyOldGoodWicketPanel {
> >     almost the same stuff
> > }
> >
> > and an appropriate markup file:
> >
> > MyNewPanel.html with following markup:
> >
> > <wicket:panel>
> >  ... other stuff ...
> > </wicket:panel>
> >
> > It worked pretty well in the Wicket 1.5, but now I get Exceptions, that
> the
> > components from the super class (MyOldGoodWicketPanel) are not found in
> the
> > subclass/ in the markup file of the sublclass...
> >
> > Can somebody explain me what happened?
> >
> > Regards,
> > Dmitriy
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Re: Problem with markup inheritance in Wicket 6

Posted by Dmitriy Neretin <dm...@googlemail.com>.
Hi guys,

you are absolutely right. There wasn't a bug... I just overseen that there
were some changes. Other developers introduced another component with
appropriate html tag in the super class so I didn't see that.

Regards,
Dmitriy

2013/2/1 Martin Grigorov <mg...@apache.org>

> Hi,
>
> I think there are no changes in this area.
> Do you extend/inherit the markup or completely override it ?
> I expect to see <wicket:extend> instead of <wicket:panel> in
> MyNewPanel.html.
> Create a quickstart and attach it to a ticket in Jira please.
>
>
> On Fri, Feb 1, 2013 at 2:12 PM, Dmitriy Neretin <
> dmitriy.neretin@googlemail.com> wrote:
>
> > Hi Folks,
> >
> > I have another problem during Wicket 6 migration. This time it is a
> problem
> > with markup inheritance.
> >
> > I have an old wicket panel and appropriate markup file:
> > MyOldGoodWicketPanel & MyOldGoodWicketPanel.html
> >
> > Markup file looks like this:
> >
> > <wicket:panel>
> >  ... stuff ...
> > </wicket:panel>
> >
> > Some months ago I needed for the same Panel another Markup, so what I
> did:
> >
> > class MyNewPanel extends MyOldGoodWicketPanel {
> >     almost the same stuff
> > }
> >
> > and an appropriate markup file:
> >
> > MyNewPanel.html with following markup:
> >
> > <wicket:panel>
> >  ... other stuff ...
> > </wicket:panel>
> >
> > It worked pretty well in the Wicket 1.5, but now I get Exceptions, that
> the
> > components from the super class (MyOldGoodWicketPanel) are not found in
> the
> > subclass/ in the markup file of the sublclass...
> >
> > Can somebody explain me what happened?
> >
> > Regards,
> > Dmitriy
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Re: Problem with markup inheritance in Wicket 6

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think there are no changes in this area.
Do you extend/inherit the markup or completely override it ?
I expect to see <wicket:extend> instead of <wicket:panel> in
MyNewPanel.html.
Create a quickstart and attach it to a ticket in Jira please.


On Fri, Feb 1, 2013 at 2:12 PM, Dmitriy Neretin <
dmitriy.neretin@googlemail.com> wrote:

> Hi Folks,
>
> I have another problem during Wicket 6 migration. This time it is a problem
> with markup inheritance.
>
> I have an old wicket panel and appropriate markup file:
> MyOldGoodWicketPanel & MyOldGoodWicketPanel.html
>
> Markup file looks like this:
>
> <wicket:panel>
>  ... stuff ...
> </wicket:panel>
>
> Some months ago I needed for the same Panel another Markup, so what I did:
>
> class MyNewPanel extends MyOldGoodWicketPanel {
>     almost the same stuff
> }
>
> and an appropriate markup file:
>
> MyNewPanel.html with following markup:
>
> <wicket:panel>
>  ... other stuff ...
> </wicket:panel>
>
> It worked pretty well in the Wicket 1.5, but now I get Exceptions, that the
> components from the super class (MyOldGoodWicketPanel) are not found in the
> subclass/ in the markup file of the sublclass...
>
> Can somebody explain me what happened?
>
> Regards,
> Dmitriy
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>