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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:29:40+00:00 2026-06-13T05:29:40+00:00

I need to set a value to bean that was retrieved on page via

  • 0

I need to set a value to bean that was retrieved on page via a request scoped managed bean #{pim}(when the page initially loaded) to #{requestScope} when commandButton is pressed.
However when the command button is pressed it uses the value of freshly instantiated #{pim} bean which would be empty.

        #{pim.targetId}

        <p:commandButton value="View">    
            <f:setPropertyActionListener value="#{pim.targetId}" target="#{requestScope.id}" />  
        </p:commandButton>

But this doesn’t work as #{pim} bean containing value got destroyed after request. I expected it to work hoping that it would assign the value that was retrieved when the page loaded but it doesnt work that way.

  • 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-13T05:29:42+00:00Added an answer on June 13, 2026 at 5:29 am

    Use <f:param> instead of <f:setPropertyActionListener>. The former sets the request parameter directly in the generated ajax script during rendering the command button, while the latter sets the property entirely in the server side during processing the form submit (which is thus already lost as this concerns a brand new request and it’s a request scoped property).

    <f:param name="id" value="#{pim.targetId}" />  
    

    with

    @ManagedProperty("#{param.id}") 
    private Long targetId;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to instantiate a session bean from another request scoped bean & set
I need to set the value of a field in a form via JavaScript.
I need to write a generic procedure that set value for one column or
I have a session-scoped bean in Spring that is set within the web context.
I need to sometimes set the value of an int to null and sometimes
I need a data structure that holds unique values (like a set), but also
I have a String that I'm autowiring as a bean. The value for the
Just wondering how to set a hidden field value so that when I submit
what wrong with this Query ??? i need this Query. UPDATE user_preferences SET user_preferences_value
On the select event of the datepicker I need to add and set values

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.