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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:45:55+00:00 2026-06-02T17:45:55+00:00

Sorry, really really basic question… I’ve got a list of ‘messageboard threads’ that I

  • 0

Sorry, really really basic question…

I’ve got a list of ‘messageboard threads’ that I display on a page. I want to be able to click on one of them and redirect to a page which displays the details for that thread. I’m struggling despite googling it for a while…

(I’m using PrimeFaces by the way)

Here’s the relevant code from my ‘list’ page:

<p:commandLink value="#{thread.title}" action="#{messageboardBean.showThread()}"> 
    <f:param name="threadId" value="#{thread.id}" />
</p:commandLink>

(it’s in an h:form element)

This is part of my named bean (other methods work fine)

...
    @ManagedProperty(value="#{param.threadId}")
    private Long threadId;
...
    public String showThread() {
        System.out.println("id is " + getThreadId());
        return "messageboard/list";
    }
...

As you can see my method isn’t implemented yet, but it’s not even being called. Please can someone tell me why?

I tried with an h:link too by the way, same (or similar) problem.

Thanks!

UPDATE – Solved

Thanks to the help below, here is my solution (I’ve renamed ‘messageboard’ to ‘discussion’).

The link is generated using this code

value: what to display on the page, in my case the title of my discussion
outcome: refers to edit.xhtml, the faces file I want to go to
…and the [request] param is going to be called ‘threadId’ and has a value of the id attribute in my ‘thread’ object.

In the edit.xhtml page, I’ve got this

<f:metadata>
    <f:viewParam name="threadId" value="#{viewDiscussionBean.threadId}" />
    <f:event type="preRenderView" listener="#{viewDiscussionBean.loadDiscussion}" />
</f:metadata>

Note that ‘threadId’ is the same as the param name in the first page, and it is bound to my viewDiscussionBean’s threadId property.

Then once the params are all set on my bean, I call the loadDiscussion method of my viewDiscussionBean. Since it now has the threadId property, it’s able to do this (see below)

My viewDiscussionBean has the following managed property (I think the viewParam tag sets this, rather than the other way around).

@ManagedProperty(value="#{param.threadId}")
private Long threadId; 

private Discussion thread;

So once that’s set, this method is able to run (because it now has an ID)

public String loadDiscussion() {
    thread = mbDao.find(threadId);
    return "edit";
}

This just uses a DAO (using Hibernate) to look up the discussion thread with that ID, and set it in the bean. And then…

In my edit.xhtml page, I can access values in the discussion thread using things like

<h:outputText value="#{viewDiscussionBean.thread.message}" />

Voila! Thanks.

  • 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-02T17:45:56+00:00Added an answer on June 2, 2026 at 5:45 pm

    There are many possible caused for an UICommand action not being invoked. You can find them all here: commandButton/commandLink/ajax action/listener method not invoked or input value not updated Among others a missing form, a nested form, or a conversion/validation error elsewhere in the form, being in a datatable whose datamodel is not properly preserved, etcetera.

    As to your particular functional requirement, better is to use a <h:link>. A command link issues a POST request which does in your particular case not end up with a bookmarkable URL with the thread ID in the URL. A <h:link> creates a fullworthy link which is bookmarkable and searchbot-indexable.

    E.g.

    <h:link value="#{thread.title}" outcome="messageboard/list"> 
        <f:param name="threadId" value="#{thread.id}" />
    </h:link>
    

    This doesn’t require a form nor an action method. You only need to move that @ManagedProperty to the bean associated with messageboard/list, or maybe replace it by <f:viewParam> in the messageboard/list view which allows for finer-grained validation/conversion.

    See also:

    • Communication in JSF2 – Processing GET request parameters
    • When should I use h:outputLink instead of h:commandLink?
    • ViewParam vs @ManagedProperty(value = "#{param.id}")
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this is a really basic question but it's been really getting to
G'day All, I am working in R. Sorry about this really basic question, but
I might be asking a very basic question and I am sorry for that.
this is a really basic question, sorry! So i have this text file in
Sorry in advance if this is a really basic Matrix/OpenGl question. I have a
First, I am really sorry for my poor english. Now when I use Ext.List
Sorry if this sounds like a really stupid question, but I need to make
I'm really new to VSTO so sorry if this is a newbie question. I'm
(Not really a programming question, sorry) I'm working on benchmarking various filesystems (most importantly:
Really stupid question, sorry, but I can't find it on google (I'm sure it's

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.