aksarben (2) [Avatar] Offline
#1
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 submit a form with GPS coordinates, so I wanted Wicket to render a simple Web page with the GPS coordinates in hidden form fields, then submit the form to the map viewer URL as soon as the page renders.

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() {
selectMapMenu();
}
};
link.setDefaultFormProcessing(false);
link.setEnabled(true);
link.setRenderBodyOnly(false);
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) {
error(ex.getMessage());
}
}
}


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.
a11158 (10) [Avatar] Offline
#2
Re: Opening Wicket Page in New Browser Tab/Window
try to set i in the markup:

<a wicket:id='mylink' target='_blank'></a>

Message was edited by:
a11158
aksarben (2) [Avatar] Offline
#3
Re: Opening Wicket Page in New Browser Tab/Window
Unfortunately, this particular link is in a dropdown menu, using the Link class. Though we have link.add(new SimpleAttributeModifier("target", "_blank")), it had no effect. We finally went with a popup window, with is still unsatisfactory, because in browsers like Firefox, you can't force the popup to open in a new tab.