Master_T Master_T - 4 months ago 15x
HTML Question

Removing an HTML tag using Wicket

I am using wicket to develop a web application. Let's say I have the following HTML:

<div wicket:id="myDiv">

Now, that
is there because most of the time I want to write content inside it.
But what if there are cases where I want to delete that
(and its content) entirely? Is this possible in wicket?

I tried:


in my Java backend, but it throws an exception:

Unexpected RuntimeException
Last cause: Unable to find a component with id 'myDiv' to remove

Any hints? I'm new to wicket and I find that it's incredibly difficult to find documentation on how to do even trivial things like this one...


The simplest solution is adding an invisible WebMarkupContainer, then it won't render in the resulting HTML code: