You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alexandros Karypidis <ak...@yahoo.gr> on 2011/04/24 22:41:52 UTC

Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

Hello,

I want to add menus (as in a menu bar with drop-down menus) on my pages.
In order to achieve that, I must use a nested RepeatingView (see further
down for the explanation). What I need (and don't know how to do) is to be
able to have markup like this:

	<ul class="web-menu">
		<li wicket:id="menuBarChoices">
			<ul>
				<li wicket:id="menuBarChoiceItems"></li>
			</ul>
		</li>
	</ul>

In my code, I would use RepeatingView to generate a number of list-items  
(menuBarChoices) which would be rendered as a menu bar. In addition I  
would need to create a NESTED RepeatingView per each of the  
"menuBarChoices", to generate a number of list-items (menuBarChoiceItems).  
These would be rendered as a drop-down menu when the user hovers over the  
respective menu bar choice.

I tried to do that, but Wicket catches my attempt to nest the  
RepeatingView components and politely explains that the "outer" component  
"discard" its content, therefore the nested "embedded" component can no  
longer be used for dynamic content. The message is as follows:

"Last cause: Expected close tag for '<li wicket:id="menuBarChoices">'  
Possible attempt to embed component(s) '<li  
wicket:id="menuBarChoiceItems">' in the body of this component which  
discards its body."

Ultimately, I need Wicket to produce something like this:

<ul class="web-menu">
	<li>
		Menu1
		<ul>
			<li>Menu Subitem 1</li>
			<li>Menu Subitem 2</li>
		</ul>

	</li>
	<li>
		Menu2
		<ul>
			<li>Menu Subitem 1</li>
			<li>Menu Subitem 2</li>
		</ul>
	</li>
</ul>

How do I go about doing that?

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


Re: Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

Posted by Alexandros Karypidis <ak...@yahoo.gr>.
Hi,

I actually managed to get around this by creating a component called  
DropDownMenu with the following HTML:

<html xmlns:wicket>
	<body>
		<wicket:panel>
			<span wicket:id="menu"></span>
			<ul>
				<li wicket:id="menuChoices"></li>
			</ul>
		</wicket:panel>
	</body>
</html>

The DropDownMenu.java code creates a repeating view (the nested one) and  
adds the "menuChoices".

Then, I simply add instances of "new DropDownMenu(...)" to the "outer"  
RepeatingView which I've also converted into a separate "MenuBar"  
component.

On Mon, 25 Apr 2011 00:13:46 +0300, James Carman  
<ja...@carmanconsulting.com> wrote:

> Check out the YUI menu support in wicketstuff.  It works great for us.
>
> On Sun, Apr 24, 2011 at 4:41 PM, Alexandros Karypidis  
> <ak...@yahoo.gr> wrote:
>> Hello,
>>
>> I want to add menus (as in a menu bar with drop-down menus) on my pages.
>> In order to achieve that, I must use a nested RepeatingView (see further
>> down for the explanation). What I need (and don't know how to do) is to  
>> be
>> able to have markup like this:
>>
>>        <ul class="web-menu">
>>                <li wicket:id="menuBarChoices">
>>                        <ul>
>>                                <li wicket:id="menuBarChoiceItems"></li>
>>                        </ul>
>>                </li>
>>        </ul>
>>
>> In my code, I would use RepeatingView to generate a number of list-items
>> (menuBarChoices) which would be rendered as a menu bar. In addition I  
>> would
>> need to create a NESTED RepeatingView per each of the "menuBarChoices",  
>> to
>> generate a number of list-items (menuBarChoiceItems). These would be
>> rendered as a drop-down menu when the user hovers over the respective  
>> menu
>> bar choice.
>>
>> I tried to do that, but Wicket catches my attempt to nest the  
>> RepeatingView
>> components and politely explains that the "outer" component "discard"  
>> its
>> content, therefore the nested "embedded" component can no longer be  
>> used for
>> dynamic content. The message is as follows:
>>
>> "Last cause: Expected close tag for '<li wicket:id="menuBarChoices">'
>> Possible attempt to embed component(s) '<li  
>> wicket:id="menuBarChoiceItems">'
>> in the body of this component which discards its body."
>>
>> Ultimately, I need Wicket to produce something like this:
>>
>> <ul class="web-menu">
>>        <li>
>>                Menu1
>>                <ul>
>>                        <li>Menu Subitem 1</li>
>>                        <li>Menu Subitem 2</li>
>>                </ul>
>>
>>        </li>
>>        <li>
>>                Menu2
>>                <ul>
>>                        <li>Menu Subitem 1</li>
>>                        <li>Menu Subitem 2</li>
>>                </ul>
>>        </li>
>> </ul>
>>
>> How do I go about doing that?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org

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


Re: Nesting "RepeatingView" components: "Possible attempt to embed component(s)" error

Posted by James Carman <ja...@carmanconsulting.com>.
Check out the YUI menu support in wicketstuff.  It works great for us.

On Sun, Apr 24, 2011 at 4:41 PM, Alexandros Karypidis <ak...@yahoo.gr> wrote:
> Hello,
>
> I want to add menus (as in a menu bar with drop-down menus) on my pages.
> In order to achieve that, I must use a nested RepeatingView (see further
> down for the explanation). What I need (and don't know how to do) is to be
> able to have markup like this:
>
>        <ul class="web-menu">
>                <li wicket:id="menuBarChoices">
>                        <ul>
>                                <li wicket:id="menuBarChoiceItems"></li>
>                        </ul>
>                </li>
>        </ul>
>
> In my code, I would use RepeatingView to generate a number of list-items
> (menuBarChoices) which would be rendered as a menu bar. In addition I would
> need to create a NESTED RepeatingView per each of the "menuBarChoices", to
> generate a number of list-items (menuBarChoiceItems). These would be
> rendered as a drop-down menu when the user hovers over the respective menu
> bar choice.
>
> I tried to do that, but Wicket catches my attempt to nest the RepeatingView
> components and politely explains that the "outer" component "discard" its
> content, therefore the nested "embedded" component can no longer be used for
> dynamic content. The message is as follows:
>
> "Last cause: Expected close tag for '<li wicket:id="menuBarChoices">'
> Possible attempt to embed component(s) '<li wicket:id="menuBarChoiceItems">'
> in the body of this component which discards its body."
>
> Ultimately, I need Wicket to produce something like this:
>
> <ul class="web-menu">
>        <li>
>                Menu1
>                <ul>
>                        <li>Menu Subitem 1</li>
>                        <li>Menu Subitem 2</li>
>                </ul>
>
>        </li>
>        <li>
>                Menu2
>                <ul>
>                        <li>Menu Subitem 1</li>
>                        <li>Menu Subitem 2</li>
>                </ul>
>        </li>
> </ul>
>
> How do I go about doing that?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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