You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by 非 谢 <xi...@hotmail.com> on 2007/11/27 16:03:47 UTC

replacing component causes "Expected close tag for xxx" Exception

hi, 

In wicket1.3-rc1, When I try to replace a WebMarkupContainer that has nested components with another component in AjaxLink.onClick, wicket says

"Expected close tag for '<span wicket:id="container">' Possible attempt to embed component(s) '<span wicket:id="nested-component">' in the body of this component which discards its body
"
Is this an expected result?  I think the above senario is quite common. Currently I am using a fragment to represent the "default" content of the container which can be replaced without any complaint but this feels not that natural. 

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

Re: replacing component causes "Expected close tag for xxx" Exception

Posted by Martijn Dashorst <ma...@gmail.com>.
This is an invalid request: changing the component hierarchy without
matching markup is wrong.
Martijn

On Nov 28, 2007 12:08 PM, Johan Compagner <jc...@gmail.com> wrote:

> please make a jira issue for this with a small sample case or unit test
>
> On Nov 28, 2007 3:13 AM, xiefei <xi...@hotmail.com> wrote:
>
> > Should not "Replace" mean turning
> > <div wicket:id="container">[whatever content of old container</div>
> > into
> > <div wicket:id="container">[whatever content of new container irrelevant
> > to content of old container]</div>
> > ?
> >
> > And, Panel as the new container does not work either. Some code may make
> > it clear.
> > IndexPage.java:
> >
> > public class IndexPage extends WebPage {
> >    public IndexPage() {        WebMarkupContainer container = new
> > WebMarkupContainer("container");        container.add(new
> > Label("nested-component", "nested-component"));
> > container.setOutputMarkupId(true);        add(container);
> >  add(new AjaxLink("ReplaceContainer"){            @Override
> >  public void onClick(AjaxRequestTarget target) {
>  NewContainer
> > newContainer = new NewContainer("container");
> > newContainer.add(new Label("new-nested-component",
> > "new-nested-componet"));                newContainer.setOutputMarkupId
> (true);
> >                IndexPage.this.addOrReplace(newContainer);
> > target.addComponent(newContainer);            }                    });
> >  }        private class NewContainer extends Panel {        public
> > NewContainer(String id){            super(id);        }
>  }}IndexPage.html:
> >
> > <span wicket:id="container">
> >   <span wicket:id="nested-component"></span>
> > </span<a wicket:id="ReplaceContainer">Click me to replace the container
> > with a new one. </a>
> >
> > IndexPage$NewContainer.html:
> >
> > <wicket:panel><span
> > wicket:id="new-nested-component"></span></wicket:panel>
> >
> > When i click "ReplaceContainer" link, wicket throws exception: "close
> tag
> > not found for tag: <span id="container1" wicket:id="container"> ..."
> >
> >
> >
> > > Date: Tue, 27 Nov 2007 09:46:55 -0800> From: igor.vaynberg@gmail.com>
> > To: users@wicket.apache.org> Subject: Re: replacing component causes
> > "Expected close tag for xxx" Exception> > you cant replace something
> like:>
> > > <div wicket:id="container"><div wicket:id="inner"></div></div> with a>
> > label, because then your markup is> > <div wicket:id="label"><div
> > wicket:id="inner"></div></div> and labels> do not support inner
> components>
> > > makes sense?> > -igor> > > On Nov 27, 2007 7:03 AM, 非 谢 <
> > xie___fei@hotmail.com> wrote:> > hi,> >> > In wicket1.3-rc1, When I try
> to
> > replace a WebMarkupContainer that has nested components with another
> > component in AjaxLink.onClick, wicket says> >> > "Expected close tag for
> > '<span wicket:id="container">' Possible attempt to embed component(s)
> '<span
> > wicket:id="nested-component">' in the body of this component which
> discards
> > its body> > "> > Is this an expected result? I think the above senario
> is
> > quite common. Currently I am using a fragment to repr
> >   esent the "default" content of the container which can be replaced
> > without any complaint but this feels not that natural.> >> >
> > _________________________________________________________________> >
> > Discover the new Windows Vista> >
> > http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
> > _________________________________________________________________
> > 手机也能上 MSN 聊天了,快来试试吧!
> > http://mobile.msn.com.cn/
> >
>



-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/

Re: replacing component causes "Expected close tag for xxx" Exception

Posted by Johan Compagner <jc...@gmail.com>.
please make a jira issue for this with a small sample case or unit test

On Nov 28, 2007 3:13 AM, xiefei <xi...@hotmail.com> wrote:

> Should not "Replace" mean turning
> <div wicket:id="container">[whatever content of old container</div>
> into
> <div wicket:id="container">[whatever content of new container irrelevant
> to content of old container]</div>
> ?
>
> And, Panel as the new container does not work either. Some code may make
> it clear.
> IndexPage.java:
>
> public class IndexPage extends WebPage {
>    public IndexPage() {        WebMarkupContainer container = new
> WebMarkupContainer("container");        container.add(new
> Label("nested-component", "nested-component"));
> container.setOutputMarkupId(true);        add(container);
>  add(new AjaxLink("ReplaceContainer"){            @Override
>  public void onClick(AjaxRequestTarget target) {                NewContainer
> newContainer = new NewContainer("container");
> newContainer.add(new Label("new-nested-component",
> "new-nested-componet"));                newContainer.setOutputMarkupId(true);
>                IndexPage.this.addOrReplace(newContainer);
> target.addComponent(newContainer);            }                    });
>  }        private class NewContainer extends Panel {        public
> NewContainer(String id){            super(id);        }    }}IndexPage.html:
>
> <span wicket:id="container">
>   <span wicket:id="nested-component"></span>
> </span<a wicket:id="ReplaceContainer">Click me to replace the container
> with a new one. </a>
>
> IndexPage$NewContainer.html:
>
> <wicket:panel><span
> wicket:id="new-nested-component"></span></wicket:panel>
>
> When i click "ReplaceContainer" link, wicket throws exception: "close tag
> not found for tag: <span id="container1" wicket:id="container"> ..."
>
>
>
> > Date: Tue, 27 Nov 2007 09:46:55 -0800> From: igor.vaynberg@gmail.com>
> To: users@wicket.apache.org> Subject: Re: replacing component causes
> "Expected close tag for xxx" Exception> > you cant replace something like:>
> > <div wicket:id="container"><div wicket:id="inner"></div></div> with a>
> label, because then your markup is> > <div wicket:id="label"><div
> wicket:id="inner"></div></div> and labels> do not support inner components>
> > makes sense?> > -igor> > > On Nov 27, 2007 7:03 AM, 非 谢 <
> xie___fei@hotmail.com> wrote:> > hi,> >> > In wicket1.3-rc1, When I try to
> replace a WebMarkupContainer that has nested components with another
> component in AjaxLink.onClick, wicket says> >> > "Expected close tag for
> '<span wicket:id="container">' Possible attempt to embed component(s) '<span
> wicket:id="nested-component">' in the body of this component which discards
> its body> > "> > Is this an expected result? I think the above senario is
> quite common. Currently I am using a fragment to repr
>   esent the "default" content of the container which can be replaced
> without any complaint but this feels not that natural.> >> >
> _________________________________________________________________> >
> Discover the new Windows Vista> >
> http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
> _________________________________________________________________
> 手机也能上 MSN 聊天了,快来试试吧!
> http://mobile.msn.com.cn/
>

RE: replacing component causes "Expected close tag for xxx" Exception

Posted by xiefei <xi...@hotmail.com>.
Should not "Replace" mean turning 
<div wicket:id="container">[whatever content of old container</div>
into 
<div wicket:id="container">[whatever content of new container irrelevant to content of old container]</div>
?
 
And, Panel as the new container does not work either. Some code may make it clear.
IndexPage.java:
 
public class IndexPage extends WebPage {
    public IndexPage() {        WebMarkupContainer container = new WebMarkupContainer("container");        container.add(new Label("nested-component", "nested-component"));        container.setOutputMarkupId(true);        add(container);                add(new AjaxLink("ReplaceContainer"){            @Override            public void onClick(AjaxRequestTarget target) {                NewContainer newContainer = new NewContainer("container");                newContainer.add(new Label("new-nested-component", "new-nested-componet"));                newContainer.setOutputMarkupId(true);                IndexPage.this.addOrReplace(newContainer);                target.addComponent(newContainer);            }                    });    }        private class NewContainer extends Panel {        public NewContainer(String id){            super(id);        }    }}IndexPage.html:
 
<span wicket:id="container">
   <span wicket:id="nested-component"></span>
</span<a wicket:id="ReplaceContainer">Click me to replace the container with a new one. </a>
 
IndexPage$NewContainer.html:
 
<wicket:panel><span wicket:id="new-nested-component"></span></wicket:panel>
 
When i click "ReplaceContainer" link, wicket throws exception: "close tag not found for tag: <span id="container1" wicket:id="container"> ..."



> Date: Tue, 27 Nov 2007 09:46:55 -0800> From: igor.vaynberg@gmail.com> To: users@wicket.apache.org> Subject: Re: replacing component causes "Expected close tag for xxx" Exception> > you cant replace something like:> > <div wicket:id="container"><div wicket:id="inner"></div></div> with a> label, because then your markup is> > <div wicket:id="label"><div wicket:id="inner"></div></div> and labels> do not support inner components> > makes sense?> > -igor> > > On Nov 27, 2007 7:03 AM, 非 谢 <xi...@hotmail.com> wrote:> > hi,> >> > In wicket1.3-rc1, When I try to replace a WebMarkupContainer that has nested components with another component in AjaxLink.onClick, wicket says> >> > "Expected close tag for '<span wicket:id="container">' Possible attempt to embed component(s) '<span wicket:id="nested-component">' in the body of this component which discards its body> > "> > Is this an expected result? I think the above senario is quite common. Currently I am using a fragment to repr
 esent the "default" content of the container which can be replaced without any complaint but this feels not that natural.> >> > _________________________________________________________________> > Discover the new Windows Vista> > http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
_________________________________________________________________
手机也能上 MSN 聊天了,快来试试吧!
http://mobile.msn.com.cn/

Re: replacing component causes "Expected close tag for xxx" Exception

Posted by Igor Vaynberg <ig...@gmail.com>.
you cant replace something like:

<div wicket:id="container"><div wicket:id="inner"></div></div> with a
label, because then your markup is

<div wicket:id="label"><div wicket:id="inner"></div></div> and labels
do not support inner components

makes sense?

-igor


On Nov 27, 2007 7:03 AM, 非 谢 <xi...@hotmail.com> wrote:
> hi,
>
> In wicket1.3-rc1, When I try to replace a WebMarkupContainer that has nested components with another component in AjaxLink.onClick, wicket says
>
> "Expected close tag for '<span wicket:id="container">' Possible attempt to embed component(s) '<span wicket:id="nested-component">' in the body of this component which discards its body
> "
> Is this an expected result?  I think the above senario is quite common. Currently I am using a fragment to represent the "default" content of the container which can be replaced without any complaint but this feels not that natural.
>
> _________________________________________________________________
> Discover the new Windows Vista
> http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE