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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:36:26+00:00 2026-05-28T20:36:26+00:00

we have a (in our oppinion) very simple scenario here. But we got stuck

  • 0

we have a (in our oppinion) very simple scenario here. But we got stuck somehow on composite components and f:attribute tags. I’ll try to keep the code as simple as possible.

Composite Component:

<cc:interface name="button">
    ...
    <cc:attribute
        name="actionListener"
        required="true"
        method-signature="void f(javax.faces.event.ActionEvent)"
        target="button"
        shortDescription="The action listener for this button." />
    ...
</cc:interface>

<cc:implementation>
    <ice:commandButton
        ...
        actionListener="#{cc.attrs.actionListener}"
        ...>

        <cc:insertChildren />
    </ice:commandButton>
</cc:implementation>

… now we use the component like this:

<ctrl:button
    ...
    actionListener="#{bean.method}"
    ...>
    <f:attribute name="objectId" value="#{someObject.id}" />
</ctrl:button>

Now we need to access the “objectId” attribute inside the action listener method. We already tried somethign like this:

public void method(ActionEvent event)
{
    ...
    event.getComponent().getAttributes().get("objectId");
    ...
}

But the attribute map doesn’t contain the objectId. Is there anything wrong on this approach? What is the recommended way to solve this problem?

Would be nice if someone could help us out.

Thanks! SlimShady

  • 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-28T20:36:27+00:00Added an answer on May 28, 2026 at 8:36 pm

    This <f:attribute> hack is a leftover from JSF 1.0/1.1 when it was not possible to pass objects as additional arguments to command buttons/links. Since JSF 1.2 you are supposed to use <f:setPropertyActionListener> for this.

    <ctrl:button action="#{bean.method}">
        <f:setPropertyActionListener target="#{bean.objectId}" value="#{someObject.id}" />
    </ctrl:button>
    

    Since EL 2.2 (which is standard part of Servlet 3.0 but is for Servlet 2.5 implementable with help of JBoss EL) you could instead even pass the whole object just as method argument:

    <ctrl:button action="#{bean.method(someObject.id)}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems like a simple problem: I have an SVN repo inside our firewall. I
We have our large build broken into many build files with a master build
We have our own custom calendar in our portal which is developed in Java.
We have our own media player built in Javascript and I was wondering if
We have our own data streaming algorithm that include some metadata+records+fields values. Currently we
So we have our J2EE application using Log4j like this public class CustomerController {
We (small team) currently have our Visual Studio projects on a network drive (no
I would like to have our web applications pull static content (css, js, images)
We need to have our apps be translated into other languages. This entails renaming
Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we

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.