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 7800583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:41:05+00:00 2026-06-02T00:41:05+00:00

What is the proper way to call a servlet from a facelets file using

  • 0

What is the proper way to call a servlet from a facelets file using a form with submit button? Is there a particular form required?

  • 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-02T00:41:07+00:00Added an answer on June 2, 2026 at 12:41 am

    Just use a plain HTML <form> instead of a JSF <h:form>. The JSF <h:form> sends by default a POST request to the URL of the current view ID and invokes by default the FacesServlet. It does not allow you to change the form action URL or method. A plain HTML <form> allows you to specify a different URL and, if necessary, also the method.

    The following kickoff example sends a search request to Google:

    <form action="http://google.com/search">
        <input type="text" name="q" />
        <input type="submit" />
    </form>
    

    Note that you do not need to use JSF components for the inputs/buttons as well. It is possible to use <h:inputText> and so on, but the values won’t be set in the associated backing bean. The JSF component overhead is then unnecessary.

    When you want, for example, to send a POST request to a servlet which is mapped to a URL pattern of /foo/* and you need to send a request parameter with the name bar, then you need to create the form as follows:

    <form action="#{request.contextPath}/foo" method="post">
        <input type="text" name="bar" />
        <input type="submit" />
    </form>
    

    This way the servlet’s doPost() method will be invoked:

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String bar = request.getParameter("bar");
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the proper way to call up a form and wait until it
Is there a proper way to use Monotouch.Dialog (iOs) and call a UIViewController when
what is the proper way to call a specific id or class of a
What's the proper way to initialize a class_attribute in Rails? I am using this:
What's the proper way to convert from a scientific notation string such as 1.234567E-06
What is the proper way to terminate a Swing application from the code, and
the code i'm using is below. Is this the proper way to use Session?
What is the proper way to call a ASMX Web Service with MicrosoftAjax.js if
Is there a proper way to rebind events in JQuery UI when tabs are
I was wondering what's the proper way of raising events from C++/CLI. In C#

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.