Get component Id in managed bean

Hi experts,
I am going to ask a foolish question, but since i'm a newbie i hope you'll forgive me .
I am using JDev version: 11.1.2.3.0. My question is: Is it possible to get a component id inside a managed bean? By components i mean, buttons or menu items. The scenario i would like to create is this:
I am using JasperReports to generate some required reports. I would like to do something like having a Menu with different items. By clicking each one of them, set a string in the managed bean i'm using to generate the reports (actually the string would be the name of the jrxml file i am going to load). And this string would get it's value based on which menu item is selected.
Is it possible to do such a thing? Or may be some other way would be more suitable?
Thank you in advance!

MenuRenderer  is a class that renders the current value of
  UISelectOne  or  UISelectMany  component as a list of
   menu options and makes use of getId.
https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCwQFjAA&url=http%3A%2F%2Fjava.net%2Fprojects%2Fmoja…

Similar Messages

  • Re:How to get the vo from managed bean

    Hi all,
    I am using Jdev11.1.2.3.0
    My requirement is : I have one jspx page.In that page i have created one form,so i need to get the values from managed bean.here i wont create by using data control view instance.so finally i have to get the table values from managed bean.so how can i get it.can anyone help me please.
    Thanks,
    G.Shilpa

    So you're not using ADF BC at all, right ?
    From JSF point of view, it does not matter how you provide UI control values.
    What you can do, for example, is to use pure JDBC in order to get and display the database values.
    What you need in your backing bean, is appropriate properties (setter/getter method pairs).
    In the getter, you can obtain DB values by using JDBC
    Take a look at:
    JSF 2.0 + JDBC integration example
    JSF JDBC Integration
    JDBC in JSF - YouTube

  • Changing row selection of a af:table component in a managed bean

    Hi,
    how can ich programmatically change the selected row of a <af:table> component within a managed bean class?
    I have a table which depends on the date settings of a <dvt:timeSelector> of a <dvt:lineGraph> component. Now when the timeSelector is moved to new dates the table should be refreshed by executing the query for the table again with the new dates. The problem is when the query of the table's view object is executed again the first row will be automatically selected after executing.
    Now I want to achieve that the last row I have selected will be selected again after moving the time selector.
    I searched already in the OTN Discussion Forum but didn't find a fitting solution.
    Thanks in advance!

    The problem is that executing the query moves the current roe to the first one.
    What you can do is to save the current row (its pk), execute the query and then set the current row to the pk of the saved selected one. Set the table attribute displayRow="selected" and set the selected row of the table to the now current row.
    One problem is that you have to be sure the last selected row is still in the record set of the new query result.
    Here are some pointers with code:
    Keep the scroll position on partial commit in <af:table>
    Jdev 11G ADF BC: rollback and keeping current row problem
    How can I programmatically select row to edit in ADF - 11g
    Timo

  • Is there any method to get page name in managed bean? jsf2.0

    Please help. Want to get page name in managed bean (application scoped). Page invoke bean through actionListener method.
    Thanks in advance.

    So, two solutions:
    FacesContext.getCurrentInstance().getViewRoot().getViewId() - actual page
    FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap().get("referer") - url in browser

  • Why a getter method of a managed bean WILL be called multiple times

    Why a getter method of a managed bean WILL be called multiple times during the JSF lifecycle?Why this designed?

    This is by design indeed. Each step in the JSF lifecycle can call a getter to get the required information.

  • How to get ADF UI Component value in managed bean

    JDev version 11.1.1.1.3.0
    I have written a managed bean method and calling that method on valueChangeEvent of a Select boolean Checkbox ADF Component.
    I want to retreive the value of some other component located in the same page as the checkbox. I need the value of the component into the manged bean. I know how to get the value of the checkbox eg:
    public void selectCheckBoxListener(ValueChangeEvent evt){ 
    boolean selectedValue = (Boolean)evt.getNewValue();
    String oldvalue = (String)evt.getOldValue();
    How can I access the value of an input text component in the above managed bean ? Can someone help on this?

    Hi Sackam,
    String selectedRowId = (String)(evt.getComponent().findComponent("rowId")).getAttributes().get("value");
    The above coding will work fine
    but wht u have specified rowId???? whether the "value" field is inside a af:table????? if so i have doubt on the above code's working.....
    Regards,
    Suganth.G

  • Can't get JSF to access managed bean methods from web page

    I'm using NetBeans 6.7.1 and Glassfish v2.1
    Having problems here can somebody please help? It is really
    frustrating because I have written apps like this before in fact I
    used one as a model to create an even simpler app and still can't get
    it to work. I ran it through the debugger and it stops in the
    constructor so it looks like the bean object is being created, but the
    setUid method and the testit method are not being entered when I click
    on the enter commandbutton. Can somebody PLEASE give me an idea as to
    what might be going on? I am totally stumped and this is holding up
    some important work I need to get done. Any help would be greatly
    appreciated:
    web.xml:
    - Show quoted text -
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <context-param>
    <param-name>com.sun.faces.verifyObjects</param-name>
    <param-value>false</param-value>
    </context-param>
    <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>faces/welcomeJSF.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    faces-config.xml:
    <?xml version='1.0' encoding='UTF-8'?>
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config version="1.2"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <managed-bean>
    <managed-bean-name>testbean</managed-bean-name>
    <managed-bean-class>com.lingosys.quoteest.testbean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/go.jsp</from-view-id>
    <navigation-case>
    <from-outcome>correct</from-outcome>
    <to-view-id>/ok.jsp</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    go.jsp:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%--
    This file is an entry point for JavaServer Faces application.
    --%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>JSP Page</title>
    </head>
    <body>
    <f:view>
    <h1>JAS Generator</h1>
    <p/>
    <h:form id="testForm" enctype="multipart/form-data" >
    <p/>Both fields are required.
    <p/>Enter Test ID: <h:inputText id="pid"
    value="#{testbean.uid}" required="true"/>
    <p/><h:commandButton value="Enter"
    action="#{testbean.testit}"/>
    </h:form>
    </f:view>
    </body>
    </html>
    testbean.java:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.lingosys.quoteest;
    * @author mphoenix
    public class testbean {
    private String uid;
    public testbean() {
    int x=0;
    public String getUid() {
    return uid;
    public void setUid(String uid) {
    this.uid = uid;
    public String testit() {
    return "correct";
    }

    MikePhoenix wrote:
    enctype="multipart/form-data"
    Why?
    Oh, in the future please post code in code blocks. Use the CODE button to get them. Use the Preview tab to see if anything went right.

  • How to access backing bean of a xml component , in a managed bean of ADF

    Hi,
    We wrote a xml component in JSF and this component is used in ADF project by including the component as jar .
    In a master detail page , we need to update the value of the xml component, when the master row is changed. How to do this.
    We are trying to do this by accessing the backing bean of the xml component in ADF project's managed bean. So when ever the row changes, we can access the managed bean in ADF and then can set the value of the xml component by accessing it's backing bean
    But i can't access the backing bean instance of the xml component in the ADF managed bean. Could you let me know how to do this. Thanks .

    Thanks for the response Shay. The xml component is added as a custom component , with a separate faces-config.xml file . This component is added to ADF project as a jar with a custom tag.
    In the ADF project , i'm having different managed beans and i can access them from a different managed bean.
    The issue is, i can't access the added custom component's backing bean which is available from a different jar , defined in a separate faces-config.xml file . This backing bean is defined with request scope.

  • How to call partial trigger on JSFF component from separate managed bean?

    Guys and Gals,
    Using JDev 11.1.1.2.0. Looked on the forums and google. Initial results aren't so great.
    Is it possible to call a PPR on a JSFF component from a separate managed bean? It seems calling the FacesContext in this instance calls the root JSPX, which only contains one child: the RichDocument.
          UIComponent component =
             FacesContext.getCurrentInstance().getViewRoot().findComponent("pc1:table1");
          if (component != null)
             AdfFacesContext context = AdfFacesContext.getCurrentInstance();
             context.addPartialTarget(component);
          System.out.println(FacesContext.getCurrentInstance().getViewRoot().getChildCount());Returns 1 :(
    Ideas for a workaround?
    Edited by: LovettWB on Nov 17, 2010 3:39 AM
    Edited by: LovettWB on Nov 17, 2010 4:11 AM
    Edited by: LovettWB on Nov 17, 2010 4:12 AM

    Thanks! Joonas, you've been a great help.
    The code on the page you referenced was close, but the code on a page referenced in the user comments was even better:
    http://www.jroller.com/mert/entry/how_to_find_a_uicomponent
    My region is located in a facet, which the page you posted doesn't quite cover, but the page above fixed that. Here's the fix below:
    In Managed Bean
          // search for the region ID (or task flow) in the base page
          UIComponent base = jsfUtils.findComponentInRoot("dynamicRegion");
          // now find component ID from within that region
          UIComponent partTable = jsfUtils.findComponent(base, "partTable");
          // call PPR on your found component
          AdfFacesContext.getCurrentInstance().addPartialTarget(partTable);In JSFUtils utility class
       // used to locate region.  Could also find any component
       // located in the base ViewRoot()
       public static UIComponent findComponentInRoot(String id) {
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, id);
        return component;
        // Recursive method which finds your component within JSFF
        // regardless of facet or other UIComponents which may have children
    public static UIComponent findComponent(UIComponent base, String id) {
        if (id.equals(base.getId()))
          return base;
        UIComponent kid = null;
        UIComponent result = null;
        Iterator kids = base.getFacetsAndChildren();
        while (kids.hasNext() && (result == null)) {
          kid = (UIComponent) kids.next();
          if (id.equals(kid.getId())) {
            result = kid;
            break;
          result = findComponent(kid, id);
          if (result != null) {
            break;
        return result;
    }Good stuff to know!

  • Cannot get reference to a managed bean from another

    After reading one of BlausC article:
    http://balusc.blogspot.com/2006/06/communication-in-jsf.html#AccessingAnotherManagedBean
    I always get null when I try to get a reference to a session scoped managed bean from a current bean:
    Here is part of the faces context config file:
    <faces-config>
    <managed-bean>
      <managed-bean-name>approvalManagementBean</managed-bean-name>
      <managed-bean-class>com.waseel.waseele.presentation.approval.management.ApprovalManagementBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
      <property-name>configService</property-name>
      <property-class>com.waseel.waseele.business.config.ConfigService</property-class>
       <value>#{configService}</value>
      </managed-property>
      <managed-property>
       <property-name>approvalService</property-name>
       <property-class>com.waseel.waseele.business.approval.ApprovalService</property-class>
       <value>#{approvalService}</value>
      </managed-property>
      <managed-property>
       <property-name>claimManagementService</property-name>
       <property-class>com.waseel.waseele.business.claim.management.ClaimManagementService</property-class>
       <value>#{claimManagementService}</value>
      </managed-property>
      <managed-property>
       <property-name>codedValuesLoaderServices</property-name>
       <property-class>com.waseel.waseele.business.claim.extraction.loader.codedValuesLoader.CodedValuesLoaderServices</property-class>
       <value>#{codedValue}</value>
      </managed-property>
      <managed-property>
       <property-name>approvalSubmission</property-name>
       <property-class>com.waseel.waseele.business.approval.submission.ApprovalSubmission</property-class>
       <value>#{approvalSubmission}</value>
      </managed-property>
      <managed-property>
       <property-name>payerTpaRelationService</property-name>
       <property-class>com.waseel.waseele.business.payerTpaRelation.PayerTpaRelationService</property-class>
       <value>#{payerTpaRelationService}</value>
      </managed-property>
    <managed-property>
    <property-name>payerTpaFiller</property-name>
    <property-class>com.waseel.waseele.business.payerTpaRelation.PayerTpaFiller</property-class>
    <value>#{payerTpaFiller}</value>
    </managed-property>
    </managed-bean>and part of my code:
    public String displayApprovalInEditMode()throws Exception{          
              //This is cross-managed been access; I  need to get the current Approval in the approval management been
              ApprovalManagementBean appMangBean=(ApprovalManagementBean) FacesContext.getCurrentInstance()
                                                      .getExternalContext().getSessionMap().get("approvalManagementBean");What possible problems may be?
    Can any one tell when these session managed beans object get created? is it at start up? or when loading a JSF page that use a bean ?
    becasue this code work in places while not in another

    You must be doing something wrong. I cannot reproduce this problem with the following SSCCE on JSF 1.2_13 at Tomcat 6.0.20.
    Bean1package mypackage;
    public class Bean1 {
        private Bean2 bean2;
        public boolean isBean2Present() {
            return bean2 != null;
        public Bean2 getBean2() {
            return bean2;
        public void setBean2(Bean2 bean2) {
            this.bean2 = bean2;
    }Bean2package mypackage;
    public class Bean2 {
    }JSF<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <f:view>
        <html>
            <head>
                <title>Test</title>
            </head>
            <body>
                <h:outputText value="Is bean2 present? #{bean1.bean2Present ? 'yes' : 'no'}" />
           </body>
        </html>
    </f:view>faces-config<?xml version="1.0" encoding="UTF-8"?>
    <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
        version="1.2">
        <managed-bean>
            <managed-bean-name>bean1</managed-bean-name>
            <managed-bean-class>mypackage.Bean1</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
            <managed-property>
                <property-name>bean2</property-name>
                <value>#{bean2}</value>
            </managed-property>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>bean2</managed-bean-name>
            <managed-bean-class>mypackage.Bean2</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    </faces-config>It prints 'yes'.

  • How can i get the realpath of my web application in jsf manage bean

    in jsp, i can use application.getRealPath("/")
    but in jsf how can i get the realpath in manage bean and initializean variable.
    thanks

    FacesContext aFacesContext = FacesContext.getCurrentInstance();          
    ServletContext context = (ServletContext)aFacesContext.getExternalContext().getContext();
    String rootpath = context.getRealPath("/");
    i use the code like that ,it can work , but when i click a button in my web page and call a function of java bean to read a file in "rootpath" , only odd number click it do well , even number click it do nothing and navigate to a blank page.
    how can i do that ,.
    my english is too pool ,sorry.

  • Error while opening a popup from managed bean

    Hi,
    I am trying to open a popup from bean, after another popup is closed. When I open the second popup either through ActionListener(on first popup button) or DialogListener(on first popup), I am getting the below error on browser status bar(!); and the second popup doesn't open. There is no error in the log.
    *'AdfPage.PAGE.findComponent(...)' is null or not an object.*
    Although the popup id is there on the jspx page.
    <af:popup id="confirmationStatus" binding="#{MyBean1.confirmationStatus}">
    <af:dialog cancelVisible="false"
    closeIconVisible="false" binding="#{MyBean1.d2}"
    title="Appointment Confirmation Status">
    <af:outputText value="Appointment is successfully confirmed"/>
    </af:dialog>
    </af:popup>
    public void confirmAppointment_dialogListener(DialogEvent dialogEvent) {
    FacesContext context = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(context, ExtendedRenderKitService.class);
    String popupId = "confirmationStatus";
    service.addScript(context,"AdfPage.PAGE.findComponent('" + popupId + "').show();");
    Please tell me why my popup is not getting open from the managed bean and I am getting an error in below line.
    service.addScript(context,"AdfPage.PAGE.findComponent('" + popupId + "').show();");

    To find out the right address of a component related to an other component, open your page select the component you want to add a partial trigger, go to the partial trigger property, select the down arrow at the right end and select 'Edit'. Now look for the popup in the component tree shown on the left side. When you have found the popup shuffle it the the selected side and click OK. The string you see in the field is the full address of the popup related to he component you've selected. Try the string you see there in your bean code. Remove the string from the partial trigger property, it's just to get the correct path.
    One other thing to check is that your popup has the ClientComponent property set to true.
    Next thing to try, is to use AdfPage.PAGE.findComponentByAbsoluteId(...)
    Timo

  • How to expose UI components in a managed bean?

    Dear all
    I created a jsf page without exposing UI components in managed beans.
    And the page is created successfully.
    But now I want to expose UI components in managed beans again
    How to make this??
    Please help

    select your component in Jdeveloper main menu, in the property inspector find Binding property -->click Edit to bind this component to a managed bean property.

  • Accessing the ViewRowImpl in Managed Bean

    Hi,
    I am having the requiredment like setting the data to view object based on some conditions. Here after setting the data to a view object, i dont want to make my transaction as dirty, so am using the populateAttribute. since am setting the single attribute am planing to get the ViewRowImpl and want set the data in my managed bean instead of writing the service method in viewImpl.
    is it the good approach to get the viewRowImpl in managed Bean.. Please suggest...
    Reg,
    Brahma B.

    Hi Frank Thanks for your reply...
    Here i will create a record before loading the screen in add mode for accepting the user input. after creation of the record i will set some data programatically(the data may be usefull for dropdown which i attached to the a perticular column).
    Reg,
    Brahma B.

  • ADF Faces: Managed Beans

    Hi All,
    I have a situation where i need to pass the value to managed bean at runtime which inturn changes the values of menubar,menulist please can any one help me out.
    Regards
    Manasa Chanda

    What you probably want to do is expose the menubar.menulist component to your managed bean. This is fairly easy to do by editing the "Binding" property of the component. This will let you specify a Managed Bean, and a Property, or you can press a New button to create the bean, and/or the Property. Once you've exposed the component, the properties of the component are available through EL, including being able to change those properties from other components.

Maybe you are looking for

  • Help! what does battery with ! mean?

    I connect my ipod mini to the computer and the battery with the '!' mark shows up and nothing happens. I read a link someone sent in response to the same question and it still did not answer my question. I use the same cable and connect another iPod,

  • 2 header lines in ALV report

    Hello All,             Does any one have any idea how to create 2 Header lines in an ALv report as in 1 cummulative header and under that 2nd detailed header. Please help me out. Cheers, Deepthee Kasal

  • Exporting and changing parameter

    Hi abapers,                     I am working object oriented abap and i need a small example of ,how to use                    export and changing parameter of a method.                    Can anyone help me regarding this sanjay

  • E-Recruiting Setting up Requisition

    Hello Experts, I am trying to Set up E-Recruiting and I have a Problem with the Requisition Process with WebDynpro Abap. We have installed the Business Packages correctly, but when I try to  create a Requisition by our Portal I get a Window with an e

  • Silent installation of Adobe Photoshop element 10

    Hello I installed Adobe Photoshop Element 10 without silent installtion. then following products are installed. 1.Element 10 organiser 2.Adobe Air 3. Adobe Community Help 4.Adobe Photoshop.com Inspiration Browser 5.Adobe Photoshop Element10 These 5 p