You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Andrea Del Bene (JIRA)" <ji...@apache.org> on 2017/10/19 14:05:02 UTC
[jira] [Commented] (WICKET-6467) wicket:child nested inside
container can not be found by Wicket
[ https://issues.apache.org/jira/browse/WICKET-6467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16211080#comment-16211080 ]
Andrea Del Bene commented on WICKET-6467:
-----------------------------------------
Hi [~eximius],
the solution in this particular case is to make *BaseComponent* implements *IComponentResolver*:
{code}
public class ChildComponent extends BaseComponent implements IComponentResolver {
private static final long serialVersionUID = -4136429757104422543L;
public ChildComponent(String id) {
super(id);
}
@Override
protected void onInitialize() {
super.onInitialize();
add(new Label("child", "I'm the child"));
}
@Override
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) {
return get(tag.getId());
}
}
{code}
Method *resolve* is called when a child component can not be resolved using the regular markup.
> wicket:child nested inside container can not be found by Wicket
> ---------------------------------------------------------------
>
> Key: WICKET-6467
> URL: https://issues.apache.org/jira/browse/WICKET-6467
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 8.0.0-M7
> Reporter: Kamil
> Assignee: Andrea Del Bene
> Attachments: showcase-childExtend.zip
>
>
> Sample app in attachment.
> When wicket:child is not "top level" component but is nested inside another Wicket container, it can not be found by Wicket and exception is being thrown:
> {code}
> 17:06:34.719 [qtp767010715-12] ERROR org.apache.wicket.MarkupContainer - Unable to find component with id 'child' in [Form [Component id = form]]
> Expected: 'test:form:child'.
> Found with similar names: 'test:child'
> 17:06:34.721 [qtp767010715-12] WARN RequestCycleExtra - ********************************
> 17:06:34.722 [qtp767010715-12] WARN RequestCycleExtra - Handling the following exception
> org.apache.wicket.markup.MarkupException: Unable to find component with id 'child' in [Form [Component id = form]]
> Expected: 'test:form:child'.
> Found with similar names: 'test:child'
> {code}
> I know, that it will work if I make "form" accessible for the child and add component there, but It is clearly not what:
> {code}
> We should not require the subclass to start worrying about the exact implementation of the super class.
> {code}
> stands for (https://issues.apache.org/jira/browse/WICKET-5580)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)