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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:57:10+00:00 2026-06-11T14:57:10+00:00

OminiFaces’s ‘o:methodParam’ does now work for me as below. How can I use another

  • 0

OminiFaces’s ‘o:methodParam’ does now work for me as below. How can I use another way? I don’t know what I am missing in it. It can work with <h:commandButton> and <a4j:jsFunction> without using Seam , When Seam is used it does not work with <a4j:jsFunction>.

Development Eviroment is
RichFaces 4.
Seam 2.3
OminiFaces 1.2 JBoss 7.1.1

@Name("DataTableBacking")
public class DataTableBacking {

    Department[] items = {new Department("AAA", "AAA"), new Department("BBB", "BBB"), new Department("CCC", "CCC")};

    public Department[] getItems() {
        return items;
    }

    public void action(Department action) {
        System.out.println("Action called with:" + action.getName());
    }

}

datatable.xhtml

<h:html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:richm="http://developmentTutorials.com/java">
        <h:body>
            <h:form>
            <h1>Data Table</h1>
                <rich:dataTable id="departmentTable" value="#{DataTableBacking.items}" var="dep" style="width:100%">
                    <rich:column style="width:100px;text-align:center;">
                        #{dep.name}
                        <richm:confirmLink actionBeanMethod="#{DataTableBacking.action(dep)}" render="departmentTable"/>
                    </rich:column>
                </rich:dataTable>
            </h:form>
        </h:body>
</h:html>

In tag lib, confirmation.xml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:o="http://omnifaces.org/ui"
    xmlns:of="http://omnifaces.org/functions"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <o:methodParam name="methodParam" value="#{actionBeanMethod}" />

    <a4j:commandLink value="delete" onclick="#{rich:component('confirmation')}.show();return false" />

    <h:commandButton value="direct" action="#{methodParam}" />

    <a4j:jsFunction name="submit" action="#{methodParam}" render="#{render}" />

    <rich:popupPanel id="confirmation" width="250" height="150">
        <f:facet name="header">Confirmation</f:facet>
        <h:panelGrid>

            <h:panelGrid columns="1">
                <h:outputText value="Are you sure?" style="FONT-SIZE: large;" />
            </h:panelGrid>

            <h:panelGroup>
                <input type="button" value="OK" onclick="#{rich:component('confirmation')}.hide(); submit(); return false" />
                <input type="button" value="Cancel" onclick="#{rich:component('confirmation')}.hide(); return false" />
            </h:panelGroup>
        </h:panelGrid>
    </rich:popupPanel>

</ui:composition>
  • 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-11T14:57:11+00:00Added an answer on June 11, 2026 at 2:57 pm

    I’m not entirely sure about the null value. If data would be absent after the post-back (an often recurring mistake) the method should not be called at all.

    You do have a bug in your code though, and that’s that a4j:jsFunction will create a function and assign it to a js variable named submit, and this will be the same for every row.

    So submit=function(){RichFaces.ajax("j_idt15:departmentTable:0:j_idt18" ... for the first row, submit=function(){RichFaces.ajax("j_idt15:departmentTable:1:j_idt18" ... for the second row, and so on.

    Your dialog will then always call the one from the last row. So, possible, is there a null as the last value in the list that you feed the table?

    Using the following slightly simplified code, I get the passed parameter in the action method:

    @ManagedBean
    public class DataTableBacking {
    
        String[] items = {"A", "B"};
    
        public String[] getItems() {
            return items;
        }
    
        public void action(String action) {
            System.out.println("Action called with:" + action);
        }
    
    }
    

    datatable.xhtml:

    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:rich="http://richfaces.org/rich"
        xmlns:a4j="http://richfaces.org/a4j"
        xmlns:richm="http://developmentTutorials.com/java"
    >
        <h:head/>
        <h:body>
    
            <h:form>
                <rich:dataTable id="departmentTable" value="#{dataTableBacking.items}" var="dep" style="width:100%">
                    <rich:column style="width:100px;text-align:center;">
                        #{dep}
                        <richm:confirmLink actionBeanMethod="#{dataTableBacking.action(dep)}" render="departmentTable"/>
                    </rich:column>
                </rich:dataTable>
            </h:form>
    
        </h:body>
    </html>
    

    confirmation.xhtml:

    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:rich="http://richfaces.org/rich"
        xmlns:a4j="http://richfaces.org/a4j" 
        xmlns:o="http://omnifaces.org/ui"
        xmlns:of="http://omnifaces.org/functions"
        xmlns:ui="http://java.sun.com/jsf/facelets">
        <o:methodParam name="methodParam" value="#{actionBeanMethod}" />
    
        <a4j:commandLink value="delete" onclick="#{rich:component('confirmation')}.show();return false" />
    
        <h:commandButton value="direct" action="#{methodParam}" />
    
        <a4j:jsFunction name="submit" action="#{methodParam}" render="#{render}" />
    
        <rich:popupPanel id="confirmation" width="250" height="150">
            <f:facet name="header">Confirmation</f:facet>
            <h:panelGrid>
    
                <h:panelGrid columns="1">
                    <h:outputText value="Are you sure?" style="FONT-SIZE: large;" />
                </h:panelGrid>
    
                <h:panelGroup>
                    <input type="button" value="OK" onclick="#{rich:component('confirmation')}.hide(); submit(); return false" />
                    <input type="button" value="Cancel" onclick="#{rich:component('confirmation')}.hide(); return false" />
                </h:panelGroup>
            </h:panelGrid>
        </rich:popupPanel>
    
    </ui:composition>
    

    I added the direct call via a h:commandButton to validate that the expression does make it correctly to the Facelet tag. In this example, when I click the delete link and confirm, I get the last element (B) as expected in the action() method for both rows.

    I used JBoss AS 7.1.1, OmniFaces 1.2 Snapshot and RichFaces 4.0.0. The OmniFaces version shouldn’t matter too much as I didn’t make any changes to the methodParam between those versions (I’m the author of that particular part).

    Which server and with which versions of OmniFaces and RichFaces are you using?

    Edit

    Per the comments, changing the String into a Department:

    DataTableBacking.java:

    @ManagedBean
    public class DataTableBacking {
    
        Department[] items = {new Department(), new Department()};
    
        public Department[] getItems() {
            return items;
        }
    
        public void action(Department action) {
            System.out.println("Action called with:" + action);
        }
    
    }
    

    Department.java:

    public class Department {
    
    }
    

    (all the other code the same as before)

    This should and (at my side) indeed does not make any difference. When you changed the String array into a Department one, did you do it in the same way as I did? Can you show your full backing bean?

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

Sidebar

Related Questions

I'm using JSF 2 and Primefaces. But I now need to do some more
I cannot get locales to work. System EAR and WAR Glassfish: 3.12 Hibernate 4.2
I have below code in jsp myDisplayImage.jsp <!DOCTYPE html> <html> <head> <meta http-equiv=Content-Type content=text/html;
I'm using Omnifaces FullAjaxExceptionHandler - which is working great, but when I do an
I've been looking into jsf technologies lately such as primefaces , primefaces-extensions , omnifaces
I have created web-application using JSF 2.0 & JSP and facing some weird problem.
What i want to do in my JSF 2 application is to set proper
Setup: JSF, PrimeFaces 3.2, Omnifaces 1.1, JBoss AS 7.1.1, Final, Mojarra 2.1.7 I have

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.