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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:53:09+00:00 2026-06-14T16:53:09+00:00

I’m trying to pass a parameter between a JSF page to another, from a

  • 0

I’m trying to pass a parameter between a JSF page to another, from a bean to another. I know it is a common question, infact I’ve tried several approaches before writing it down.
To do that I have put both the beans in session scope and added in the first bean the following:

<p:commandButton value="Submit" type="submit"
    actionListener="#{sourceBean.save}" action="success">

    <f:setPropertyActionListener
            target="#{targetBean.foo}" value="#{sourceBean.foo}" />
</p:commandButton>

The problem is that I don’t want these beans to be in session scope but in view scope.
So I tried to put in my first page:

<p:commandButton value="Submit" type="submit"
    actionListener="#{sourceBean.save}" action="success">
    <f:param name="foo" value="#{sourceBean.foo}"/>                     
</p:commandButton>

And in the second page:

<f:metadata>
<f:viewParam id="foo" name="foo" value="#{targetBean.foo}"
    />
</f:metadata>

The problem is that the passed String is null so, obviously, I get an error form the Converter.

I think I’m missing something in the configuration of my managed beans. Do I have to link target and source bean in someway?
At this moment I have this configuration:

    <managed-bean>
    <managed-bean-name>targetBean</managed-bean-name>
    <managed-bean-class>guiBeans.TargetBean</managed-bean-class>
    <managed-bean-scope>view</managed-bean-scope>
</managed-bean>
<managed-bean>
    <managed-bean-name>sourceBean</managed-bean-name>
    <managed-bean-class>guiBeans.SourceBean</managed-bean-class>
    <managed-bean-scope>view</managed-bean-scope>
</managed-bean>

Another question: In my app, the value foo.id, that I use during the conversion, is set autonatically by the database when I save the object so when I call:

actionListener="#{sourceBean.save}"

The converter gets the id and turns it into a String (and viceversa, if needed).
So, I wanted to know if in JSF is first called the actionListener or the function that sets the parameters .

Could be this the reason why I get a null String? Thanks a lot.

  • 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-14T16:53:09+00:00Added an answer on June 14, 2026 at 4:53 pm

    The <f:param> is evaluated during rendering of the form, not during submitting of the form. Your problem suggests that the #{sourceBean.foo} value is only been set during submitting the form and thus not available during rendering of the form.

    You’d basically need to replace action="success" by action="#{bean.action}" with

    public String action() {
        return "success?foo=" + foo.getId();
    }
    

    Or, if you’re using navigation cases

    <navigation-case>
        <from-outcome>success</from-outcome>
        <to-view-id>/some.xhtml</to-view-id>
        <redirect>
            <view-param>
                <name>foo</name>
                <value>#{sourceBean.foo.id}</value>
            </view-param>
        </redirect>
    </navigation-case>
    

    Unrelated to the concrete problem, the <f:param> doesn’t support the converter attribute at all. You’d have to access the desired property directly (which is id in the above example).

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

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.