Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not possible to use <code>&lt;h:form&gt;</code> to submit to another server. The <code>&lt;h:form&gt;</code> submits by default to the current request URL. Also, it would automatically add extra hidden input fields such as the form identifier and the JSF view state. Also, it would change the request parameter names as represented by input field names. This all would make it insuitable for submitting it to an external server.</p> <p>Just use <code>&lt;form&gt;</code>. You can perfectly fine use plain HTML in a JSF page.</p> <hr> <p><strong>Update</strong>: as per the comments, your <em>actual</em> problem is that you have no idea how to deal with the zip file as obtained from the webservice which you're POSTing to and for which you were actually looking for the solution in the wrong direction.</p> <p>Just keep using JSF <code>&lt;h:form&gt;</code> and submit to the webservice using its usual client API and once you got the ZIP file in flavor of <code>InputStream</code> (please, do not wrap it a <code>Reader</code> as indicated in your comment, a zip file is binary content not character content), just write it to the HTTP response body via <code>ExternalContext#getResponseOutputStream()</code> as follows:</p> <pre><code>public void submit() throws IOException { InputStream zipFile = yourWebServiceClient.submit(someData); String fileName = "some.zip"; FacesContext fc = FacesContext.getCurrentInstance(); ExternalContext ec = fc.getExternalContext(); ec.responseReset(); ec.setResponseContentType("application/zip"); ec.setResponseHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); OutputStream output = ec.getResponseOutputStream(); try { byte[] buffer = new byte[1024]; for (int length = 0; (length = zipFile.read(buffer)) &gt; 0;) { output.write(buffer, 0, length); } } finally { try { output.close(); } catch (IOException ignore) {} try { zipFile.close(); } catch (IOException ignore) {} } fc.responseComplete(); } </code></pre> <h3>See also:</h3> <ul> <li><a href="https://stackoverflow.com/questions/9391838/how-to-stream-a-file-download-in-a-jsf-backing-bean/9394237#9394237q">How to provide a file download from a JSF backing bean?</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload