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") {
            @Override
            protected void onComponentTag(ComponentTag tag) {
                super.onComponentTag(tag);
                tag.put("target", "_blank");
            }
        };
--
How to find files on the Internet? FindFiles.net <http://findfiles.net>!

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() {
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.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Opening-Wicket-Page-in-New-Browser-Tab-Window-tp3752465p3752465.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




Reply via email to