How-to guides
Directions for a specific goal.
- Show, hide or disable a component Hide a component or make it read-only depending on the state of your application, and decide that state once per request in onConfigure.
- Change a tag's attributes Set, append to or remove an attribute of a component's tag from Java, with a fixed value or one that follows a model.
- Give a component a markup id Render the HTML id attribute of a component so JavaScript, CSS, labels and Ajax can find it, and choose or generate the id yourself.
- Group components with WebMarkupContainer Attach a plain HTML element to a container component so you can hide, disable, style or repaint a group of components as one.
- Build a reusable panel Package a piece of user interface as a Panel, a Java class with its own HTML file, and use it on any page as often as you need.
- Swap markup with fragments Keep small alternative pieces of markup inside a page or panel and choose in Java which one to show, without a panel class for each.
- Wrap content with a Border Write the markup that goes around content once, as a Border, and wrap any part of a page in it while the page keeps its own components.
- Hide surrounding markup with wicket:enclosure Hide a caption, label or table row together with the component it describes, without a container component in Java.
- Render a component without its tag Leave out a component's own HTML tag and render only its content, and know what stops working when you do.
- Keep preview markup out of the output Leave sample content in your HTML files so they look complete in a browser or design tool, and make sure Wicket never sends it.
- Add behavior to a component with a Behavior Write a Behavior that changes a component's tag, adds markup around it or contributes CSS and JavaScript, and reuse it on any kind of component.
- Add components without repeating the markup hierarchy Queue components on a page or panel and let Wicket put each one in the right container by following the nesting in the markup.
- Generate markup from code Give a panel or page markup built in Java instead of an HTML file, and control whether Wicket caches it.
Reference
The classes, tags and settings, described.
- Wicket tags and attributes Every tag and attribute in the wicket namespace, what it does, which attributes it takes, with a minimal example of each.
Explanation
Why Wicket works the way it does.
- Markup inheritance How a page or panel subclass inherits its parent's HTML along with its Java code, how wicket:child and wicket:extend merge the two, and when panels are the better tool.
- How markup becomes components How Wicket loads, parses and caches markup, and how Wicket tags turn into auto components that you never add yourself.