This is a solution Post of how GWT app can launch Excel or other
applications and load a file, without saving a file at server end.
The idea to save .csv/Excel resource to hardisk and later delete is more
Resource oriented. This pushed me to use above methodology. Not sure if
there are other ways to do it.
1. Include the following inherit in the .gwt.xml file
*<inherits name="com.google.gwt.http.HTTP"/>*
2. Create a new Servlet and it should extend HttpServlet class
*
public class ReadCSV extends HttpServlet{
String contents = "Hello";
response.setHeader("Content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Length",
String.valueOf(contents.length()) );
response.setHeader("Content-Disposition", "attachment; filename=\"" +
"CSVReader.CSV" + "\"");
response.getWriter().write(contents);
response.getWriter().flush();
response.getWriter().close();
}
*3. On the Click of the button Implement the click Handler and state the
following
*Window.open(GWT.getModuleBaseURL() + < your serlvet name >, "<file name>",
"");*
Here the parameters can be passed as a QueryString to the Servlet or Use
RequestBuilder to create Request Parameters.
Hope this information helps all.
Thanks,
Kalyan.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/aU1U24KK-xIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.