0

I want to open pdf-file from new blank in browser:

 String sCommand = GWT.getHostPageBaseURL() + "requiredPDF?vCompanyName="+ companyName + "&" +
                        "vCurDate=" + new Date().getTime() + "&" +
                        sTitle +
                        "vReportType=" + rt.reportType +"&" +
                        "vChartType=" + rt.iChartType +"&" +
                        sParameters +
                        "vDetalization=" + rt.detalization + "&" +
                        "vGroup=" + getCheckedGroups();

 Window.open(sCommand,"", "");

and that's work well. However, I want to use doPOST method and as I understand, Window.open() could work only with doGET method. I've looked for some issue for doPOST, but they don't open result in a new browser's blank/window.

How to use doPOST method to show result in a new browser's blank?


Upd. I change my code to bound with doPOST instead of window.open() but nothing is happen

 String sURL = GWT.getHostPageBaseURL() + "requirePDF";
 String sData = "vCompanyName="+ companyName + "&" +
                "vCurDate=" + new Date().getTime() + "&" +
                sTitle +
                "vReportType=" + rt.reportType +"&" +
                "vChartType=" + rt.iChartType +"&" +
                sParameters +
                "vDetalization=" + rt.detalization + "&" +
                "vGroup=" + getCheckedGroups();

 RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, sURL);
 builder.sendRequest(sData, new RequestCallback() {
                    @Override
                    public void onResponseReceived(Request request, Response response) {
                        FormPanel formPanel = new FormPanel();
                        formPanel.setAction(GWT.getHostPageBaseURL() + "requirePDF");
                        formPanel.setMethod(FormPanel.METHOD_POST);
                        //formPanel.submit();
                        formPanel.setVisible(true);
                        rt.add(formPanel);

                    }

                    @Override
                    public void onError(Request request, Throwable exception) {
                        MessageBox.alert("Request error","The page doesn't open", null);
                    }
                });
Kaha
  • 171
  • 4
  • 14
  • I'm not a GWT expert, but this is basic HTML. Just use `target="_blank"` in your `
    `. More info: [HTML `
    ` target Attribute](http://www.w3schools.com/tags/att_form_target.asp)
    – Luiggi Mendoza Jun 10 '13 at 05:40
  • I don't want to touch HTML code, cause it generated by GWT. Anyway, thank you for help. – Kaha Jun 10 '13 at 05:44
  • 1
    Then do it in the `onsubmit` method. Geez... You have a solution but give yourself more problems... – Luiggi Mendoza Jun 10 '13 at 05:44
  • send a post request first and get the response and passe it to the new window.. – Dilantha Jun 10 '13 at 06:59
  • 2
    http://stackoverflow.com/questions/7282987/handle-attachment-in-response-with-requestbuilder-in-gwt/7287574#7287574 – vanje Jun 10 '13 at 11:44
  • I saw it before also, but I couldn't run example with formpanel. I'll try to update my question with my code changes. It's not so clear to me, Could you give some examples? – Kaha Jun 11 '13 at 03:54

0 Answers0