Master_T Master_T - 1 year ago 92
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...

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download