I hava a servleta that serves files?
I'm building a page with a "Download" button usung a GWT.
How to make a GWT client download a file in an onClick event?
P.S. Anchor works, but Button looks better.
if you have the file address. You can open a window like below:
downloadButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.open("http://127.0.0.1:8888/file.rar", "_self", "enabled");
}
});
and that javadoc can help you http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/Window.html#open%28java.lang.String,%20java.lang.String,%20java.lang.String%29
I like
Window.Location.replace("/downloadServlet");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With