Some months ago I had the same/similar problem.

You have to add the attribute by overriding onComponentTag(ComponentTag tag). As far as I remember you should use the usual org.apache.wicket.markup.html.form.Button with it, AjaxButton won't work.

        Form<Void> form = new Form<Void>("ConvertForm") {
            protected void onComponentTag(ComponentTag tag) {
                tag.put("target", "_blank");
How to find files on the Internet? <>!

On 08/18/2011 02:30 PM, aksarben wrote:
How can I make a Wicket page open in a new browser tab/window? I'm not
talking about a popup, but a standard window. I have an app that needs to
open a GIS map viewer in a separate window, based on the user's current
context. The map viewer requires that I submit a form with GPS coordinates,
so I need Wicket to render some simple HTML with the coordinates in hidden
form fields, then submit the form to the map viewer URL as soon as the page
renders. This part is no problem. The problem is that Wicket renders the
HTML in the wrong window.

Currently, I'm using code to generate the link to invoke the map viewer:

*final MenuItem mapMenu = new EnmMenuItem("Map") {
private static final long serialVersionUID = 1L;

@Override protected AbstractLink newLink(final String componentId) {
final SubmitLink link = new SubmitLink(componentId, form) {
private static final long serialVersionUID = 1L;
@Override public void onSubmit() {
link.add(new SimpleAttributeModifier("target", "_blank"));

return link;

When the menu item is chosen, the following is invoked:

*@Override protected void selectMapMenu() {
for (final TrackSummary summary : grid.getSelectedItems()) {
try {
setResponsePage(new TrackMapRequestPage(summary.getSystemNumber()));
catch (final UnauthorizedPageError ex) {

Despite setting the link target to "_blank", the TrackMapRequestPage opens
in the SAME window as the application. How can I make it open in a DIFFERENT
window so both windows are visible at the same time? My design specs says
the new window shouldn't be a popup.

View this message in context:
Sent from the Users forum mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to