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

  • Home
  • SEARCH
  • 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 6363963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:06:14+00:00 2026-05-25T00:06:14+00:00

I have a jsf 1.2 command link <h:commandLink id=cars action=${swapViewHandler.myFunction1}> <h:commandLink id=ships action=${swapViewHandler.myFunction2}> myFunction1

  • 0

I have a jsf 1.2 command link

  <h:commandLink id="cars" action="${swapViewHandler.myFunction1}">
  <h:commandLink id="ships" action="${swapViewHandler.myFunction2}">

myFunction1 populates swapViewHandler.listA with cars and navigates to cars.xhtml

 <navigation-rule>
           <navigation-case>            
                <from-outcome>cars</from-outcome>
                <to-view-id>cars.xhtml</to-view-id>
                <redirect />
            </navigation-case>

myFunction2 populates the same swapViewHandler.listA with ships and
navigates to ships.xhtml

 <navigation-rule>
           <navigation-case>            
                <from-outcome>ships</from-outcome>
                <to-view-id>hips.xhtml</to-view-id>
                <redirect />
            </navigation-case>

I need to handle a user refresh (F5) so that when a refresh happens in
cars.xhtml myFunction1 gets called and repopulates listA (with cars )
and when ships.xhtml gets refreshed myFunction2 gets called and repopulates listA (with ships)

cars.xhtml and ships.xhtml have the same backingbean (swapviewhandler)

and they both contain

<c:forEach id="tablePicList" items="${swapViewHandler.listA}"  var="entity" varStatus ="status">
  • 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-25T00:06:14+00:00Added an answer on May 25, 2026 at 12:06 am

    Each view should have its own backing bean. Put the bean in the request scope and do the job in its (post)constructor. This will then be invoked on every fresh new GET request. E.g.

    public class CarHandler {
    
        private List<Car> cars;
    
        @EJB
        private CarService carService;
    
        @PostConstruct
        public void init() {
            cars = carService.list();
        }
    
        // ...
    }
    

    Don’t forget to change the command links to be normal output links. It’ll also give you extra SEO points as it apparently concerns pure page-to-page navigation and bookmarkable/refreshable GET requests.

    <h:outputLink value="cars.jsf">cars</h:outputLink>
    <h:outputLink value="ships.jsf">ships</h:outputLink>
    

    If the lists are dependent on some request parameter or a session scoped managed bean, then you should inject that in the backing bean as a <managed-property> in faces-config.xml. It’ll be available inside the @PostConstruct method (but not in the constructor!).

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

Sidebar

Related Questions

Explanation: I have a JSF command link that sets a member in the backing
i have a command link in my page which looks like: <h:commandLink value=Add user
I have a h:commandLink inside rich:dataTable . When I click on the command link,
I have <h:form> <h:commandLink action=#{my_fake_ajax_link}> <h:outputText value=Link /> <f:ajax render=:mydiv /> </h:commandLink> </h:form> <h:panelGroup
If you have a JSF <h:commandLink> (which uses the onclick event of an <a>
I have a component done in JSF 1.x, this component has a command button
We have JSF web application that generates XLS file and gives user link to
If A.jsf have a commandLink that will navigation to B.jsf , then I would
I have a very simple JSF 2.0 project. I have an index.xhtml file to
Have JSF 1.2 two pages(one.xhtml and other.xhtml), that are included to the current page

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.