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: [EMAIL PROTECTED]> To: 
> [email protected]> 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, 非 谢 <[EMAIL PROTECTED]> 
> 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/

Reply via email to