Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:48:14+00:00 2026-06-18T08:48:14+00:00

I want to send a HTTP post request to another server using <h:form> component.

  • 0

I want to send a HTTP post request to another server using <h:form> component.

I can send a POST request to an external site using HTML <form> component, but <h:form> component does not support this.

<form action="http://www.test.ge/get" method="post">
    <input type="text" name="name" value="test"/>
    <input type="submit" value="CALL"/>
</form>

How can I achieve this with <h:form>?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:48:15+00:00Added an answer on June 18, 2026 at 8:48 am

    It’s not possible to use <h:form> to submit to another server. The <h:form> 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.

    Just use <form>. You can perfectly fine use plain HTML in a JSF page.


    Update: as per the comments, your actual 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.

    Just keep using JSF <h:form> and submit to the webservice using its usual client API and once you got the ZIP file in flavor of InputStream (please, do not wrap it a Reader as indicated in your comment, a zip file is binary content not character content), just write it to the HTTP response body via ExternalContext#getResponseOutputStream() as follows:

    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)) > 0;) {
                output.write(buffer, 0, length);
            }
        } finally {
            try { output.close(); } catch (IOException ignore) {}
            try { zipFile.close(); } catch (IOException ignore) {}
        }
    
        fc.responseComplete();
    }
    

    See also:

    • How to provide a file download from a JSF backing bean?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send a HTTP Post Request in Delphi 2010 using WinInet, but
I want to send POST request (like html form) and get file (HTTP header:
I just want to send data using ajax post request to a remote server.
I want to send a value to the server.I send it using: $.post(http://127.0.0.1:8000/search/,{'long':30}); and
I want to send an image to a saas via an http post request.
i want to send an HTTP post request by Clicking on Button to my
The question asked here: How can I send an HTTP POST request to a
I want to send post request to some service using Java. Requests must contain
In HTML, you can send data from one page to another using a GET
There is way to send HTTP post request from my Controller? I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.