You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Parson (JIRA)" <ji...@apache.org> on 2010/03/02 16:40:29 UTC

[jira] Commented: (WICKET-1190) Replacing Component causes "close tag not found for tag" exception

    [ https://issues.apache.org/jira/browse/WICKET-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12840207#action_12840207 ] 

Peter Parson commented on WICKET-1190:
--------------------------------------

Is it possible to have a comprehensible exception message instead?

> Replacing Component causes "close tag not found for tag" exception
> ------------------------------------------------------------------
>
>                 Key: WICKET-1190
>                 URL: https://issues.apache.org/jira/browse/WICKET-1190
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-rc1
>            Reporter: xiefei
>
> There is always some part of a page that we need to replace its content with some new block of html markup retrieved from an ajax call.  What i am currently doing is using a fragment to represent the original block of html, like this:
> <span wicket:id="container"></span>
> <wicket:fragment wicket:id="original-content-of-container">
>      original contents that can contain nested component like <span wicket:id="nested-component"></span>
> <wicket:fragment>
> <a wicket:id="ReplaceContainer">Click me to replace container's content with a new one</a>
> in the java code:
> public ThePage(){
>         Fragment container = new Fragment("container", "original-content-of-container", this);
>         container.setOutputMarkupId(true);
>         container.add(new Label("nested-component", "nested component content"));
>         add(container);
>         add(new AjaxLink("ReplaceContainer"){
>              onClick(target){
>                     NewPanel newContainer = new NewPanel("container");
>                     newContainer.add(...new nested components...);
>                     newContainer.setOutputMarkupId(true);
>                     ThePage.this.addOrReplace(newContainer);
>                     target.addComponent(newContainer);
>          }
>     }
> } 
> This works fine. The container can later be replaced by another component such as a panel.  But requires an additional fragment to be defined and  disturbs the structure of the markup. IMO, the natural way is to just use a WebMarkupContainer to render the original content, like this:
> <span wicket:id="container">
>      original contents that can contain nested component like <span wicket:id="nested-component"></span>
> </span>
> <a wicket:id="ReplaceContainer">Click me to replace container's content with a new one</a>
> in the java code:
> public ThePage(){
>         WebMarkupContainer container = new WebMarkupContainer("container");
>         container.setOutputMarkupId(true);
>         container.add(new Label("nested-component", "nested component content"));
>         add(container);
>         add(new AjaxLink("ReplaceContainer"){
>              onClick(target){
>                     NewPanel newContainer = new NewPanel("container");
>                     newContainer.add(...new nested components...);
>                     newContainer.setOutputMarkupId(true);
>                     ThePage.this.addOrReplace(newContainer);
>                     target.addComponent(newContainer);
>          }
>     }
> }
> The above codes render the original container successfully. But the replace action only works if the original container does not have any nested components.  When it has some,  wicket throws an exception says : "close tag not found for tag: <span id="container1" wicket:id="container"> ..."

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.