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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:36:02+00:00 2026-05-23T12:36:02+00:00

My web application has two search pages – search1.jsf and search2.jsf – which share

  • 0

My web application has two search pages – search1.jsf and search2.jsf – which share the same bean which in turn calls a result page – result.jsf.

So both search pages have a commandButton

 <h:commandButton value="Commit" action="#{search.commit}" />

The “search” bean then processes the search and forwards to the result page using

target = "result?faces-redirect=true";

Now the result.jsf doesn’t know which search page has been used. How can I pass the calling page so that the called page is able to render a link back to the calling page?

Using the browser back button (or Javascript code) to go back in the history has the disadvantage that the user, after browsing through the results, only would go back one page in the results instead of going ‘up’ to the search parameter form.

Options I see so far are:

  • pass the caller page name through the chain to the result page, using <f:param> or action=”#{search.commit(name_of_calling_page)}

  • put all ‘search parameter’ forms in one JSF page and conditionally switch the content

Or is there a JSF functions which returns the name of the calling JSF page?

  • 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-23T12:36:03+00:00Added an answer on May 23, 2026 at 12:36 pm

    You’re redirecting to the result page which suggests that you’re using a session scoped bean to hold the results (a request/view scoped simply doesn’t survive redirects). Ignoring the fact that this is a poor/odd approach, you could just store the search type in that bean as well?

    Anyway, easiest and cleanest is to use a single master view with a single master view scoped bean and conditionally display search1.xhtml, search2.xhtml and results.xhtml using <ui:include> in the master view.

    search.xhtml

    <ui:fragment rendered="#{empty search.results}">
        <ui:include src="/WEB-INF/search#{search.type}.xhtml" />
    </ui:fragment>
    <ui:fragment rendered="#{not empty search.results}">
        <ui:include src="/WEB-INF/results.xhtml" />
    </ui:fragment>
    

    As long as you return void or null in action methods, the same view scoped bean will be retained on every subsequent (and non-redirected!) request. If you intend to make it a GET instead of POST (so that it’s bookmarkable and back-button-navigable such as Google), then you should actually change the forms and view parameters to make it GET instead of POST.

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

Sidebar

Related Questions

I'm working on an ASP.NET web application. There's a bill page which has two
I have a codeigniter web application which has two buttons guest or user. The
I have a web application which has two servlets that exchange information through context
I am building a web application using ASP.NET MVC that has two very distinct
I'm working on a solution that has two projects: One ASP.NET web application, and
I'm writing a little web application that has two things in it : At
I have a working web application which already has a login and registration system.
I'm developing a web application which has the need of a powerful .doc editor.
I'm working on web application which has a database UserName|Password|UserType Anil|Anil|Manager ghouse|Ghouse|Admin raghu|raghu|User Now
My web application has a login page that submits authentication credentials via an AJAX

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.