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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:56:06+00:00 2026-05-23T19:56:06+00:00

I am trying to construct equivalent of this code in JSF2 <form action=/search.xhtml method=get>

  • 0

I am trying to construct equivalent of this code in JSF2

                <form action="/search.xhtml" method="get">
                    <div class="search">
                        <input type="hidden" name="mutation" value="#{facesContext.viewRoot.locale}" />
                        <input name="searchString" class="text" />
                        <input type="submit" class="searchSubmit" value="#{msg.searchIt}" />
                    </div>
                </form>

The point of this construction is to redirect user to the search.html page, which shows the search results. The page uses URL params to decode the searchString and language mutation.
And because it uses get, it is also bookmarkable.

With JSF2 I tried to use the h:button with param for the mutation, but I dont have a clue, how to force jsf to encode the h:inputText searchString.

Thanks for your help.

  • 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-05-23T19:56:07+00:00Added an answer on May 23, 2026 at 7:56 pm

    As far as I know, there is no possibility to use method=”GET” in JSF.
    It is not what you exactly want, but may be using post-redirect-get pattern can solve your issue:

    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
        <f:metadata>
           <f:viewParam name="searchString" value="#{requestScopedBean.searchString}"/>
           <f:viewParam name="mutation" value="#{requestScopedBean.mutation}"/>
        </f:metadata>
        <h:body>
            <h:form>
                <h:inputText value="#{requestScopedBean.searchString}"/>
                <h:commandButton value="submit" action="/tests/search?faces-redirect=true&amp;includeViewParams=true">
                    <f:param name="mutation" value="whatever"/>
                </h:commandButton>
            </h:form>
        </h:body>
    
    </html>
    

    More about PRG pattern in JSF2 in this article: http://www.warski.org/blog/?p=185

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to construct a 2D array in the form of pointers-to-pointers. This doesn't
Am trying to construct a simple update query in my model class Model_DbTable_Account extends
I am trying to construct a TreeView from a Menu. My Code is like
I am trying to construct a method that will allow me to find the
Trying to construct a helper class that will return an arraylist, but I'm getting
I'm trying to implement the code under Asynchronous Exchanges from this link in the
I'm trying to construct a page layout that will look something like this: In
I'm trying to construct a find command to process a bunch of files in
I'm trying to construct a query that will include a column indicating whether or
I am trying to construct a way to keep certain hard drive partitions/usb drives

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.