Duplicate managed bean definition

Hello,
This is my first time to post on this forum and I am very excited :). Thank you all in advance for your time to read my post.
We are developing an EJB/ADF faces application using JDeveloper 11.1.1.4.0. When I deploy the application, I get the following message:
<MetadataService$Bootstrap> <add> ADFc: Duplicate managed bean definition for 'nameOfMyBean' detected.
<MetadataService$Bootstrap> <add> ADFc: /WEB-INF/adfc-config.xml:
Can anyone help me how I can resolve this?
Thanks
Hemen

For people who has the same error message:
This could be a configuration error.
Take a look into the WAR file of the EAR which will be deployed. In my case was the WEB-INF folder copied into the CLASSES folder so that he adfc-config.xml was two times in the WAR-File.
WAR-File
¦   home.jspx
¦   ...
¦
+---WEB-INF
    ¦   adfc-config.xml
    ¦   faces-config.xml
    ¦   ...
    ¦
    +---classes
        +---META-INF
        ¦       adfm.xml
        ¦
        +---WEB-INF
                adfc-config.xml
                faces-config.xml
                ...In my case I had edit WAR-Deployment configuration of the ViewContorller projekt properties. There is a tree with a node "WEB-INF/classes", which has a child node "Filters". On the right you see the files which will be deployed. I've unchecked the WEB-INF subfolder and redeployed it.
Now the errors are gone.

Similar Messages

  • Managed Bean Help for Definition Help

    I am working on creating Managed Bean Help for Definition Help as described in ‘19.5.3 How to Create Managed Bean Help’ section of the Web User Interface Developer's Guide fpr ADF. Using JDev Version 11.1.2.1.0.
    Thought I had all the artifacts assembled but when I run the log message is: <ELHelpProvider> <_getTranslationMap> ELHelpProvider's helpSourceExpression is null.
    Any suggestions would be greatly appreciated.
    Here is the managed bean:
    public class ELHelpProviderProjRequest extends ELHelpProvider {
        public ELHelpProviderProjRequest() {       
        /* To use the HelpProvider, the EL expression in the helpTopicId attribute must point to a Map, otherwise
           * you will get a coerceToType error. */
        public Map<String, String> getHelpMap()
              Iterator iterator = _HELP_MAP.entrySet().iterator();                
              while(iterator. hasNext()){       
              System.out.println("hash map entry " + iterator.next());
            return _HELP_MAP;
        static private final Map<String, String> _HELP_MAP = new HashMap<String, String>();
            static {
              // each element [put] can be for a separate helpTopicId attribute
              _HELP_MAP.put("MAPHELP_CATEGORY_CAPITAL_DEFINITION", "Map value for credit card definition");
              _HELP_MAP.put("MAPHELP_CATEGORY_OTHER_DEFINITION", "Map value for credit card instructions");         
    }  Here is the adf-setting.xml in Application sources / META-INF:
    <?xml version="1.0" encoding="windows-1252" ?>
    <adf-settings xmlns="http://xmlns.oracle.com/adf/settings" > 
      <adf-faces-config xmlns="http://xmlns.oracle.com/adf/faces/settings">
      <help-provider prefix="MAPHELP_">
        <help-provider-class>   
            com.corpnet.abc.util.ELHelpProviderProjRequest
        </help-provider-class>
        <property>
          <property-name>helpSource</property-name>
          <value>#{helpTranslationMap.helpMap}</value>
        </property>
      </help-provider>
    </adf-faces-config> 
    </adf-settings>Here is the faces-config:
    <managed-bean>
        <managed-bean-name>helpTranslationMap</managed-bean-name>
        <managed-bean-class> com.corpnet.abc.util.ELHelpProviderProjRequest </managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>Here is the helpTopicId in the inputText component:
    <af:inputText value="Test" inlineStyle="font-weight: bold;" id="it31" simple="true" helpTopicId="MAPHELP_CATEGORY_CAPITAL" readOnly="true"/>

    Register the managed-bean as a help provider in the adf-settings xml like:
    Example 19-9 Registering a Managed Bean as a Help Provider
    <adf-settings xmlns="http://xmlns.oracle.com/adf/settings">
    <adf-faces-config xmlns="http://xmlns.oracle.com/adf/faces/settings">
    <help-provider prefix="MAPHELP_">
    <help-provider-class>
    oracle.adf.view.rich.help.ELHelpProvider
    </help-provider-class>
    <property>
    <property-name>helpSource</property-name>
    <value>#{helpTranslationMap.helpMap}</value>
    </property>
    </help-provider>
    </adf-faces-config>
    </adf-settings>
    As you've pointed out, Review section 19.5.3 for more details -> http://docs.oracle.com/cd/E24382_01/web.1112/e16181/af_message.htm#CHDHIGIA
    You could also investigate use the OHW product available here: http://www.oracle.com/technetwork/developer-tools/help/index-083946.html

  • How to get iterator values from a managed bean ?

    Due to a bug in selectOneChoice i'm not able to get the label list i want to display directly from an iterator when the value binding is a managed bean.
    To solve the problem i would like to create a managed bean that contains that list and use it as the selectItems to display.
    I would like that the values in that managed bean loaded from the a data control iterator.
    My question is :
    1) is it possible to access the iterator values from a managed bean, i mean without any reference to a page definition
    2) how to do ? is it documented somewhere ? any example ?
    Thank you

    I got it also with this code:
    package view.managedBeans;
    import classification.bean.ClassificationDocument;
    import classification.castor.ClassificationLanguage;
    import java.io.FileNotFoundException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Hashtable;
    import java.util.List;
    import java.util.Locale;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.model.SelectItem;
    import oracle.adf.model.generic.DCGenericDataControl;
    import org.exolab.castor.xml.MarshalException;
    import org.exolab.castor.xml.ValidationException;
    public class ClassificationLanguageList {
    private java.util.List<SelectItem> supportedLanguages = new ArrayList();
    public ClassificationLanguageList() throws FileNotFoundException,
    MarshalException,
    ValidationException {
    FacesContext ctx = FacesContext.getCurrentInstance();
    ValueBinding vb = ctx.getApplication().createValueBinding("#{data.ClassificationDocumentDataControl}");
    DCGenericDataControl classificationDocumentDataControl = (DCGenericDataControl)vb.getValue(ctx);
    ClassificationDocument classificationDocument = (ClassificationDocument)classificationDocumentDataControl.getDataProvider();
    ClassificationLanguage[] classificationLanguage = classificationDocument.getClassification().getClassificationLanguageList().getClassificationLanguage();
    for (int counter = 1; counter < classificationLanguage.length; counter++) {
    SelectItem language = new SelectItem();
    language.setValue(classificationLanguage[counter].getClassificationLanguageCode());
    language.setLabel(classificationLanguage[counter].getClassificationLanguageLabel());
    supportedLanguages.add(language);
    public void setSupportedLanguages(java.util.List<SelectItem> supportedLanguages) {
    this.supportedLanguages = supportedLanguages;
    public java.util.List<SelectItem> getSupportedLanguages() {
    return supportedLanguages;
    }

  • Generate PDF using Managed Bean with custom HTTP headers

    Background
    Generate a report in various formats (e.g., PDF, delimited, Excel, HTML, etc.) using JDeveloper 11g Release 2 (11.1.2.3.0) upon clicking an af:commandButton. See also the StackOverflow version of this question:
    http://stackoverflow.com/q/13654625/59087
    Problem
    HTTP headers are being sent twice: once by the framework and once by a bean.
    Source Code
    The source code includes:
    - Button Action
    - Managed Bean
    - Task Flow
    Button Action
    The button action:
    <af:commandButton text="Report" id="submitReport" action="Execute" />
    Managed Bean
    The Managed Bean is fairly complex. The code to `responseComplete` is getting called, however it does not seem to be called sufficiently early to prevent the application framework from writing the HTTP headers.
    HTTP Response Header Override
    * Sets the HTTP headers required to indicate to the browser that the
    * report is to be downloaded (rather than displayed in the current
    * window).
    protected void setDownloadHeaders() {
    HttpServletResponse response = getServletResponse();
    response.setHeader( "Content-Description", getContentDescription() );
    response.setHeader( "Content-Disposition", "attachment, filename="
    + getFilename() );
    response.setHeader( "Content-Type", getContentType() );
    response.setHeader( "Content-Transfer-Encoding",
    getContentTransferEncoding() );
    Issue Response Complete
    The bean indirectly tells the framework that the response is handled (by the bean):
    getFacesContext().responseComplete();
    Bean Run and Configure
    public void run() {
    try {
    Report report = getReport();
    configure(report.getParameters());
    report.run();
    } catch (Exception e) {
    e.printStackTrace();
    private void configure(Parameters p) {
    p.put(ReportImpl.SYSTEM_REPORT_PROTOCOL, "http");
    p.put(ReportImpl.SYSTEM_REPORT_HOST, "localhost");
    p.put(ReportImpl.SYSTEM_REPORT_PORT, "7002");
    p.put(ReportImpl.SYSTEM_REPORT_PATH, "/reports/rwservlet");
    p.put(Parameters.PARAM_REPORT_FORMAT, "pdf");
    p.put("report_cmdkey", getReportName());
    p.put("report_ORACLE_1", getReportDestinationType());
    p.put("report_ORACLE_2", getReportDestinationFormat());
    Task Flow
    The Task Flow calls Execute, which refers to the bean's `run()` method:
    entry -> main -> Execute -> ReportBeanRun
    Where:
    <method-call id="ReportBeanRun">
    <description>Executes a report</description>
    <display-name>Execute Report</display-name>
    <method>#{reportBean.run}</method>
    <outcome>
    <fixed-outcome>success</fixed-outcome>
    </outcome>
    </method-call>
    The bean is assigned to the `request` scope, with a few managed properties:
    <control-flow-rule id="__3">
    <from-activity-id>main</from-activity-id>
    <control-flow-case id="ExecuteReport">
    <from-outcome>Execute</from-outcome>
    <to-activity-id>ReportBeanRun</to-activity-id>
    </control-flow-case>
    </control-flow-rule>
    <managed-bean id="ReportBean">
    <description>Executes a report</description>
    <display-name>ReportBean</display-name>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    The `<fixed-outcome>success</fixed-outcome>` strikes me as incorrect -- I don't want the method call to return to another task.
    Restrictions
    The report server receives requests from the web server exclusively. The report server URL cannot be used by browsers to download directly, for security reasons.
    Error Messages
    The error message that is generated:
    Duplicate headers received from server
    Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.Nevertheless, the report is being generated. Preventing the framework from writing the HTTP headers would resolve this issue.
    Question
    How can you set the HTTP headers in ADF while using a Task Flow to generate a PDF by calling a managed bean?
    Ideas
    Some additional ideas:
    - Override the Page Lifecycle Phase Listener (`ADFPhaseListener` + `PageLifecycle`)
    - Develop a custom Servlet on the web server
    Related Links
    - http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
    - http://www.slideshare.net/lucbors/reports-no-notes#btnNext
    - http://www.techartifact.com/blogs/2012/03/calling-oracle-report-from-adf-applications.html?goback=%2Egde_4212375_member_102062735
    - http://docs.oracle.com/cd/E29049_01/web.1112/e16182/adf_lifecycle.htm#CIABEJFB
    Thank you!

    The problem was that the HTTP headers were in fact being written twice:
    1. The report server was returning HTTP response headers.
    2. The bean was including its own HTTP response headers (as shown in the question).
    3. The bean was copying the entire contents of the report server response, including the headers, into the output stream.
    Firefox ignored the duplicate header errors, but Google Chrome did not.

  • Urgent - can't set managed bean value using a form, getting null

    I have a form with a bean -- unbelievably, I can't get the values entered into the form by the user to get stored into the bean. Everything is null... I've looked at a zillion examples, posts and compared etc...yet still can't see what is missing.
    Here's part of a trace :
    [cc]Dec-31 01:25:02 ApplicationImpl - Created bean resourceBean successfully
    [cc]Dec-31 01:25:02 ApplicationImpl - Storing resourceBean in scope request
    [cc]Dec-31 01:25:02 VariableResolverImpl - resolveVariable: Resolved variable:id=null name=null
    [cc]Dec-31 01:25:02 ValueBindingImpl - getValue Result:id=null name=null
    [cc]Dec-31 01:25:02 ValueBindingImpl - -->Returning id=null name=null
    If you have any ideas, please let me know--it seems just as I solve one JSF issue, I run into another on unexpectedly simple things.
    Here's the ResourceBean.java, the bean-config.xml and my jsp.
    package com.intalio.qa.tcm.view.beans;
    import java.util.Map;
    import javax.faces.context.FacesContext;
    import javax.faces.model.SelectItem;
    import org.apache.log4j.Logger;
    import com.intalio.qa.exceptions.DuplicateIdException;
    import com.intalio.qa.tcm.model.Resource;
    import com.intalio.qa.tcm.view.builders.ResourceBuilder;
    import com.intalio.qa.tcm.view.util.FacesUtils;
    * Resource backing bean.
    public class ResourceBean extends RootBean {
         * Class logger
         public static final Logger LOG =
              Logger.getLogger(ResourceBean.class);
    * The Resource id
         private String id = null;
         * The Resource name
         private String name = null;
    * Description
    private String description= null;
         * the resource type id associated with the Resource
         private String resourceTypeId= null;
         private static SelectItem[] resourceTypeIds = new SelectItem[] {
              new SelectItem("External Software"),
              new SelectItem("Hardware"),
              new SelectItem("Intalio Product Software"),
              new SelectItem("Machine - Dual CPU"),
              new SelectItem("Machine - CPU Single"),
              new SelectItem("Memory - UNIX"),
              new SelectItem("Memory - Windows") };
    * @return Returns the resourceTypeIds.
    public SelectItem[] getResourceTypeIds() {
    return resourceTypeIds;
    * @param resourceTypeIds The resourceTypeIds to set.
    public void setResourceTypeIds(SelectItem[] typeIds) {
    resourceTypeIds = typeIds;
         * Default constructor.
         public ResourceBean() {
    super();
    init();
         * Initializes ResourceBean.
         * @see RootBean#init()
         protected void init() {
         /*True, but I'd strongly recommend instead using:
    FacesContext fContext = FacesContext.getCurrentInstance();
    Map requestParams = fContext.getExternalContext().getRequestParameterMap();
    String companyId = (String) requestParams.get("companyID");
    The getRequest(), getSession(), and getContext() methods of ExternalContext should only be used as a last resort.*/
         * Backing bean action to update Resource.
         * @return the navigation result
         public String updateAction() {
              LOG.info("updateAction is invoked");
              try {
                   Resource Resource = ResourceBuilder.createResource(this);
                   LOG.info("ResourceId = " + Resource.getId());
              //     viewServicesManager.getResourceService().updateResource(Resource);
              } catch (Exception e) {
                   String msg = "Could not update Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error.");
                   return ActionResult.FAILURE;
              LOG.info("Resource with id of " + id + " was updated successfully.");
              return ActionResult.SUCCESS;
         * Backing bean action to create a new Resource.
         * @return the navigation result
         public String addAction() {
              try {
                   Resource resource = ResourceBuilder.createResource(this);
    LOG.info("resource created: " + resource.getName() + " with typeId = " + resource.getResourceTypeId());
                   viewServicesManager.getResourceService().saveResource(resource);
              } catch (DuplicateIdException de) {
                   String msg = "This id already exists";
                   LOG.info(msg);
                   FacesUtils.addErrorMessage(msg);
                   return ActionResult.RETRY;
              } catch (Exception e) {
                   String msg = "Could not save Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error");
                   return ActionResult.FAILURE;
              String msg = "Resource with id of " + id + " was created successfully.";
              LOG.info(msg);
              return ActionResult.SUCCESS;
         * Backing bean action to delete Resource.
         * @return the navigation result
         public String deleteAction() {
              LOG.info("deleteAction is invoked");
              try {
         //          Resource Resource = ResourceBuilder.createResource(this);
         //          viewServicesManager.getResourceService().deleteResource(Resource);
                   //remove the ResourceList inside the cache
    //               FacesUtils.resetManagedBean(BeanNames.RESOURCE_LIST_BEAN);
              } catch (Exception e) {
                   String msg = "Could not delete Resource. ";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(null, msg + "Internal Error.");
                   return ActionResult.FAILURE;
              String msg = "Resource with id of " + id + " was deleted successfully.";
              LOG.info(msg);
              FacesUtils.addInfoMessage(msg);
              return ActionResult.SUCCESS;
         public String getId() {
              return id;
         * Invoked by the JSF managed bean facility.
         * <p>
         * The id is from the request parameter.
         * If the id is not null, by using the id as the key,
         * the Resource bean is initialized.
         * @param newQueryId the query id from request parameter
         public void setId(String newId) {
              LOG.info("setId " + newId);
              id = newId;
         public String getName() {
              return name;
         public void setName(String newName) {
              name = newName;
         public String getDescription() {
              return description;
         public void setDescription(String newDescription) {
              description = newDescription;
         public String getResourceTypeId() {
              return resourceTypeId;
         public void setResourceTypeId(String newResourceTypeId) {
              resourceTypeId = newResourceTypeId;
         public String toString() {
              return "id=" + id + " name=" + name;
         <!-- view -->
         <managed-bean>
              <description>
                   Managed bean
              </description>
              <managed-bean-name>applicationBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ApplicationBean
              </managed-bean-class>
              <managed-bean-scope>application</managed-bean-scope>
              <managed-property>
                   <property-name>viewServicesManager</property-name>
                   <value>#{viewServicesManagerBean}</value>
              </managed-property>
              </managed-bean>
         <managed-bean>
              <description>
                   View service manager impl for business services
              </description>
              <managed-bean-name>viewServicesManagerBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ViewServicesManagerBean</managed-bean-class>
              <managed-bean-scope>application</managed-bean-scope>
         </managed-bean>
         <managed-bean>
              <description>
                   Backing bean that contains product information.
              </description>
              <managed-bean-name>resourceBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ResourceBean
              </managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>viewServicesManager</property-name>
                   <value>#{viewServicesManagerBean}</value>
              </managed-property>
         </managed-bean>
    </faces-config>
    <f:view>
         <h:form id="createResourceForm" target="dataFrame">
              <h:outputText value="#{applicationBean.dummyVariable}" rendered="true" />
              <div align="center">
              <head>
              <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css">
              <FONT color="#191970" size="4" face="Arial">Resources View</FONT>
              </head>
              <table style="margin-top: 2%" width="35%" cellpadding="10">
                   <div align="left">
                   <FONT color="#191970" size="3" face="Arial">Update Resources </FONT>
                   </div>
                   <tr>
                        <td align="center" valign="top" align="center" style="" bgcolor="white" />
                        <table>
                             <tbody>
                                  <tr>
                                       <td align="left" styleClass="header" width="100" />
                                       <td align="left" width="450" />
                                  </tr>
                                  <tr>
                                       <td align="right" width="100"><h:outputText value="Id" /></td>
                                       <td align="left" width="450"><h:inputText value="#{resourceBean.id}" id="id"/> <h:message for="id" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100"><h:outputText value="Name" /></td>
                                       <td align="left" width="450"><h:inputText value="#{resourceBean.name}" id="name" /> <h:message for="name" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <!--td align="right" width="100" valign="bottom"><h:outputText value="Type" /></td>
                                       <td align="left" width="550"><h:selectOneMenu>
                                            <f:selectItems value="#{resourceBean.resourceTypeIds}" />
                                       </h:selectOneMenu> <h:outputText value="#{resourceBean.resourceTypeId}" id="dresourceTypeId" /> <h:message for="resourceTypeId" styleClass="errorMessage" />
                                       </td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100" valign="bottom"><h:outputText value="Description" /></td>
                                       <td align="left" width="450"><h:inputText value="#{resourceBean.description}" id="description" size="96" /> <h:message for="description" styleClass="errorMessage" /></td>
                                  </tr>
                             </tbody>
                        </table>
         </h:form>
         </td>
         <!-- END DATA FORM -->
         <!-- BEGIN COMMANDS -->
         <td width="30%" align="left" valign="top"><h:form id="buttonCommandsForm">
              <h:panelGroup id="buttons">
                   <h:panelGrid columns="1" cellspacing="1" cellpadding="2" border="0" bgcolor="white">
                        <h:commandButton value="Add" style="height:21px; width:51px;font-size:8pt; font-color: black;" action="#{resourceBean.addAction}">
                        </h:commandButton>
                        <h:commandButton id="deleteCB" value="Delete" style="height:21px; width:51px;font-size:8pt" action="#{resourceBean.deleteAction}">
                        </h:commandButton>
                        <h:commandButton id="spaceFillerButton" style="height:21px; width:51px;font-size:8pt;background-color: #ffffff;color: #ffffff;border: 0px;">
                        </h:commandButton>
                        <h:commandButton id="saveCB" value="Save" style="height:21px; width:51px;font-size:8pt" action="#{resourceBean.saveAction}">
                        </h:commandButton>
                        <h:commandButton id="updateCB" value="Update" style="height:21px; width:51px;font-size:8pt" action="#{resourceBean.updateAction}">
                        </h:commandButton>
                   </h:panelGrid>
              </h:panelGroup>
         </h:form> <!-- end buttons --></td>
         </tr>
         </table>
         <HR align="center" size="2" width="60%" />
         <!-- data table -->
         </div>
    </f:view>
    THANKS.
    -L

    I solved this.
    Since I was testing the action code only, I didn't define a navigation entry corresponding to the action string returned for this button:
    <h:commandButton value="Add" style="height:21px; width:51px;font-size:8pt; font-color: black;" action="#{resourceBean.addAction}">
    </h:commandButton>After I added a nav definition, it worked. I don't know why at this point. I suspect a key step in the lifecycle was pre-empted...someone else can probably explain why. If I get a chance to research it after I'm done with my project, I'll update this post.
    Thanks.
    -L

  • Error calling Method on Managed Bean from another Managed Bean

    Hi
    (Jdev 11.1.1.2.0)
    Help please:
    I have a managed bean (page flow scope) which is used by my main page for dynamic region flow navigation:
    *public class RegionNavigationBean implements Serializable{*+
    private String dynamicTaskFlowId = "/WEB-INF/home-task-flow-definition.xml#home-task-flow-definition";+
    *public RegionNavigationBean() {*+
    *public TaskFlowId getDynamicTaskFlowId() {*+
    return TaskFlowId.parse(dynamicTaskFlowId);+
    *public void setDynamicTaskFlowId(String taskFlowId) {*+
    this.dynamicTaskFlowId = taskFlowId;+
    taskFlowId property on main page def is set to +*${pageFlowScope.regionNavigationBean.dynamicTaskFlowId}*+
    In a DB table (i.e. View Object on my model layer) I store a menu ID and a corresponding task_flow_id.
    Then I have created an action listener class (RegionNavigationListener - page flow scope) which I link to my menu items on my main page (action listener property on menu item = +*#{pageFlowScope.regionNavigationAction.processAction}*+ )
    In this action listener (processAction method), I retrieve the row set from the menu VO and find the record which matches my menu ID which caused the action event, thereby retrieving the task_flow_id which must be navigated to.
    I then try to retrieve the instance of the RegionNavigationBean with the following statement: RegionNavigationBean regNav = (RegionNavigationBean)JSFUtils.getManagedBeanValue("regionNavigationBean");+
    This seems to work fine, but as soon as I try and use this I get NullPointerException error, e.g.:
    regNav.setDynamicTaskFlowId(menusRow.gettaskFlowId());+
    or even:
    System.out.println("%%% " + regNav.toString());+
    This is all quite new to me... any help would be appreciated!
    Thanks
    Mario

    Hi Mario,
    I think JSFUtils.getManagedBeanValue(String) has difficult to evaluate the "regionNavigationBean" managed bean.
    What JSFUtils.getManagedBeanValue(String) do is important. I remember that "JSF scoped" bean can be found by JSF style find method, such as requestScope, sessionScope, applicationScope. For a managed bean put in these scope, scope prefix is not needed, for example: using #{beanName} to locate a requestScope bean. The #{requestScope} prefix is not needed.
    But pageFlowScope is different. If a bean is put in the pageFlowScope, you must use #{pageFlowScope.beanName} to locate it.
    Say, ManagedBean is the java class of your manged bean.
    FacesContext ctx = FacesContext.getCurrentInstance();
    Application app = ctx.getApplication();
    ManagedBean mb = (ManagedBean)app.evaluateExpressionGet(ctx, "#{pageFlowScope.managedBeanName}", ManagedBean.class);
    Hope it helps.
    Todd
    Edited by: Todd Bao on Nov 26, 2009 9:58 PM

  • JSF - Best Practice For Using Managed Bean

    I want to discuss what is the best practice for managed bean usage, especially using session scope or request scope to build database driven pages
    ---- Session Bean ----
    - In the book Core Java Server Faces, the author mentioned that most of the cases session bean should be used, unless the processing is passed on to other handler. Since JSF can store the state on client side, i think storing everything in session is not a big memory concern. (can some expert confirm this is true?) Session objects are easy to manage and states can be shared across the pages. It can make programming easy.
    In the case of a page binded to a resultset, the bean usually helds a java.util.List object for the result, which is intialized in the constructor by query the database first. However, this approach has a problem: when user navigates to other page and comes back, the data is not refreshed. You can of course solve the problem by issuing query everytime in your getXXX method. But you need to be very careful that you don't bind this XXX property too many times. In the case of querying in getXXX, setXXX is also tricky as you don't have a member to set. You usually don't want to persist the resultset changes in the setXXX as the changes may not be final, in stead, you want to handle in the actionlistener (like a save(actionevent)).
    I would glad to see your thought on this.
    --- Request Bean ---
    request bean is initialized everytime a reuqest is made. It sometimes drove me nuts because JSF seems not to be every consistent in updating model values. Suppose you have a page showing parent-children a list of records from database, and you also allow user to change directly on the children. if I hbind the parent to a bean called #{Parent} and you bind the children to ADF table (value="#{Parent.children}" var="rowValue". If I set Parent as a request scope, the setChildren method is never called when I submit the form. Not sure if this is just for ADF or it is JSF problem. But if you change the bean to session scope, everything works fine.
    I believe JSF doesn't update the bindings for all component attributes. It only update the input component value binding. Some one please verify this is true.
    In many cases, i found request bean is very hard to work with if there are lots of updates. (I have lots of trouble with update the binding value for rendered attributes).
    However, request bean is working fine for read only pages and simple binded forms. It definitely frees up memory quicker than session bean.
    ----- any comments or opinions are welcome!!! ------

    I think it should be either Option 2 or Option 3.
    Option 2 would be necessary if the bean data depends on some request parameters.
    (Example: Getting customer bean for a particular customer id)
    Otherwise Option 3 seems the reasonable approach.
    But, I am also pondering on this issue. The above are just my initial thoughts.

  • How to change MANAGED-BEAN-SCOPE??????

    Hi Gurus,
    How to change the managed-bean-scope? In my ADF application I have created one backing bean which has attched with the page fragment. I cant able to set the bean scope other than REQUEST....
    If I set the bean scope request, then page and the inside fragment is rendering without any error. But I need to make that bean scope to pageFlow... but if I do, getting the below error. Non of the scopes are working except request... Please help me how to set the other scope which will solve my major development issue!!!!
    Error:
    Error trying to include:viewId:/advsearch-flow-definition/advUserSearch uri:/app/advUserSearch.jsffjavax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'UserSearch' resolved to null
    My ADFC-Config.xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <managed-bean>
    <managed-bean-name>backing_app_idm</managed-bean-name>
    <managed-bean-class>edu.syr.oim.backing.app.Idm</managed-bean-class>
    <managed-bean-scope>backingBean</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1app/idm.jspx-->
    </managed-bean>
    <managed-bean>
    <managed-bean-name>backing_app_userMgmt</managed-bean-name>
    <managed-bean-class>edu.syr.oim.backing.app.UserMgmt</managed-bean-class>
    <managed-bean-scope>backingBean</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1app/userMgmt.jspx-->
    </managed-bean>
    *<managed-bean>*
    *<managed-bean-name>UserSearch</managed-bean-name>*
    *<managed-bean-class>edu.syr.oim.backing.app.UserSearch</managed-bean-class>*
    *<managed-bean-scope>request</managed-bean-scope>*
    *</managed-bean>*
    </adfc-config>
    -kln
    Edited by: klogube on Jan 14, 2010 7:23 AM

    *public class UserSearch {*
    private RichTable searchResultTable;
    private Row currentRow;
    private String selectedNetID;
    private RichInputText inputOne;
    private RichInputText inputTwo;
    private RichInputText inputThree;
    private RichSelectOneChoice choiceOne;
    private RichSelectOneChoice choiceTwo;
    private RichSelectOneChoice choiceThree;
    private RichRegion region;
    private String choiceOneVal;
    private String choiceTwoVal;
    private String choiceThreeVal;
    DCBindingContainer bindings;
    int choiceOneRowIndex;
    int choiceTwoRowIndex;
    int choiceThreeRowIndex;
    Row choiceOnerw;
    Row choiceTworw;
    Row choiceThreerw;
    String choiceOneUserSelected = null;
    String choiceTwoUserSelected = null;
    String choiceThreeUserSelected = null;
    static String  txnTypeOne  = null;
    static String  txnTypeTwo  = null;
    static String  txnTypeThree  = null;
    String netid;
    RequestContext requestContext = RequestContext.getCurrentInstance();
    HashMap rcBackupHM = new HashMap();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    FacesContext fc = FacesContext.getCurrentInstance();
    HttpServletRequest request = (HttpServletRequest)fc.getExternalContext().getRequest();
    HttpSession session = request.getSession();
    *public UserSearch() {*
    *public String userSelected() {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    return "goToDetails";
    ** Invoke this method when user double click the row in searchResult*
    *public void doDbClick(ClientEvent clientEvent) {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    *try{*
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "goDetails");
    *// Refresh the current region; advse1 is the id of the region component inside jspx page*
    AdfFacesContext.getCurrentInstance().addPartialTarget(region);
    *catch(Exception e){ }*
    *public void setSearchResultTable(RichTable searchResultTable) {*
    this.searchResultTable = searchResultTable;
    *public RichTable getSearchResultTable() {*
    return searchResultTable;
    *public void setInputOne(RichInputText inputOne) {*
    this.inputOne = inputOne;
    *public RichInputText getInputOne() {*
    return inputOne;
    *public void setInputTwo(RichInputText inputTwo) {*
    this.inputTwo = inputTwo;
    *public RichInputText getInputTwo() {*
    return inputTwo;
    *public void setInputThree(RichInputText inputThree) {*
    this.inputThree = inputThree;
    *public RichInputText getInputThree() {*
    return inputThree;
    *public void setChoiceOne(RichSelectOneChoice choiceOne) {*
    this.choiceOne = choiceOne;
    *public RichSelectOneChoice getChoiceOne() {*
    return choiceOne;
    *public void setChoiceTwo(RichSelectOneChoice choiceTwo) {*
    this.choiceTwo = choiceTwo;
    *public RichSelectOneChoice getChoiceTwo() {*
    return choiceTwo;
    *public void setChoiceThree(RichSelectOneChoice choiceThree) {*
    this.choiceThree = choiceThree;
    *public RichSelectOneChoice getChoiceThree() {*
    return choiceThree;
    *public void setChoiceOneVal(String choiceOneVal) {*
    this.choiceOneVal = choiceOneVal;
    *public String getChoiceOneVal() {*
    return choiceOneVal;
    *public void setChoiceTwoVal(String choiceTwoVal) {*
    this.choiceTwoVal = choiceTwoVal;
    *public String getChoiceTwoVal() {*
    return choiceTwoVal;
    *public void setChoiceThreeVal(String choiceThreeVal) {*
    this.choiceThreeVal = choiceThreeVal;
    *public String getChoiceThreeVal() {*
    return choiceThreeVal;
    *public void setRegion(RichRegion region) {*
    this.region = region;
    *public RichRegion getRegion() {*
    return region;
    Can you please explain how to define the 2nd bean in the pageFlowScope and injnect?...bacially my problem is I am loosing the pageFlowScope value when I navigate from first page to next page which I am setting by this above class....I need to carry forward the netid which I am losing ...any idea plz

  • Specify factory for managed bean

    Hello,
    I'm new to JSF and find myself duplicating a lot of code. For example, I have several pages that display data in the exact same way, even though the data collections vary (i.e. one page displays Country instances; the other State instances). Right now, I'm creating a managed bean for each type, but the beans only differ in how they populate the data (i.e. the bean for Country knows to load its data from resource X, whereas the bean for State uses a separate resource). Is there a way to specify a factory for initializing beans, or a way to pass arguments to the constructor, so that I could just use a single managed bean, with my JSF pages specifying how they want the bean initialized (i.e. for Countries, rather then States)? Am I misunderstanding some thing about managed beans? Under a servlet app, I would just populate the bean and then forward the client- I'm struggling with how to duplicate that need in JSF. Thanks for your help. Take care.

    Hello,
    I'm new to JSF and find myself duplicating a lot of code. For example, I have several pages that display data in the exact same way, even though the data collections vary (i.e. one page displays Country instances; the other State instances). Right now, I'm creating a managed bean for each type, but the beans only differ in how they populate the data (i.e. the bean for Country knows to load its data from resource X, whereas the bean for State uses a separate resource). Is there a way to specify a factory for initializing beans, or a way to pass arguments to the constructor, so that I could just use a single managed bean, with my JSF pages specifying how they want the bean initialized (i.e. for Countries, rather then States)? Am I misunderstanding some thing about managed beans? Under a servlet app, I would just populate the bean and then forward the client- I'm struggling with how to duplicate that need in JSF. Thanks for your help. Take care.

  • How to Commit table by writting Java code in Managed Bean?

    Hi,
    Can anyone suggest me how to Commit table by writing Java code in Managed Bean?.
    I want to commit table manually after modifying in UI.
    Please suggest me guys.
    Thanks,
    Ramit Mathur

    Hi Friend Copy this two java files with same package of your bean package.
    1,*ADFUtils.java*
    package org.calwin.common.view.utils;(Your package name)
    import java.util.ArrayList;
    import java.util.List;
    import javax.el.ELContext;
    import javax.el.ExpressionFactory;
    import javax.el.MethodExpression;
    import javax.el.ValueExpression;
    import javax.faces.context.FacesContext;
    import javax.faces.model.SelectItem;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.adf.model.binding.DCParameter;
    import oracle.adf.share.logging.ADFLogger;
    import oracle.binding.AttributeBinding;
    import oracle.binding.BindingContainer;
    import oracle.binding.ControlBinding;
    import oracle.binding.OperationBinding;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.Key;
    import oracle.jbo.Row;
    import oracle.jbo.uicli.binding.JUCtrlValueBinding;
    * A series of convenience functions for dealing with ADF Bindings.
    * Note: Updated for JDeveloper 11
    * @author Duncan Mills
    * @author Steve Muench
    * $Id: ADFUtils.java 2513 2007-09-20 20:39:13Z ralsmith $.
    public class ADFUtils
    public static final ADFLogger _LOGGER = ADFLogger.createADFLogger(ADFUtils.class);
    * Get application module for an application module data control by name.
    * @param pName application module data control name
    * @return ApplicationModule
    public static ApplicationModule getApplicationModuleForDataControl(String pName)
    return (ApplicationModule) JSFUtils.resolveExpression("#{data." + pName + ".dataProvider}");
    * A convenience method for getting the value of a bound attribute in the
    * current page context programatically.
    * @param pAttributeName of the bound value in the pageDef
    * @return value of the attribute
    public static Object getBoundAttributeValue(String pAttributeName)
    return findControlBinding(pAttributeName).getInputValue();
    * A convenience method for setting the value of a bound attribute in the
    * context of the current page.
    * @param pAttributeName of the bound value in the pageDef
    * @param pValue to set
    public static void setBoundAttributeValue(String pAttributeName, Object pValue)
    findControlBinding(pAttributeName).setInputValue(pValue);
    * Returns the evaluated value of a pageDef parameter.
    * @param pPageDefName reference to the page definition file of the page with the parameter
    * @param pParameterName name of the pagedef parameter
    * @return evaluated value of the parameter as a String
    public static Object getPageDefParameterValue(String pPageDefName, String pParameterName)
    BindingContainer bindings = findBindingContainer(pPageDefName);
    DCParameter param = ((DCBindingContainer) bindings).findParameter(pParameterName);
    return param.getValue();
    * Convenience method to find a DCControlBinding as an AttributeBinding
    * to get able to then call getInputValue() or setInputValue() on it.
    * @param pBindingContainer binding container
    * @param pAttributeName name of the attribute binding.
    * @return the control value binding with the name passed in.
    public static AttributeBinding findControlBinding(BindingContainer pBindingContainer, String pAttributeName)
    if (pAttributeName != null)
    if (pBindingContainer != null)
    ControlBinding ctrlBinding = pBindingContainer.getControlBinding(pAttributeName);
    if (ctrlBinding instanceof AttributeBinding)
    return (AttributeBinding) ctrlBinding;
    return null;
    * Convenience method to find a DCControlBinding as a JUCtrlValueBinding
    * to get able to then call getInputValue() or setInputValue() on it.
    * @param pAttributeName name of the attribute binding.
    * @return the control value binding with the name passed in.
    public static AttributeBinding findControlBinding(String pAttributeName)
    return findControlBinding(getBindingContainer(), pAttributeName);
    * Return the current page's binding container.
    * @return the current page's binding container
    public static BindingContainer getBindingContainer()
    return (BindingContainer) JSFUtils.resolveExpression("#{bindings}");
    * Return the Binding Container as a DCBindingContainer.
    * @return current binding container as a DCBindingContainer
    public static DCBindingContainer getDCBindingContainer()
    return (DCBindingContainer) getBindingContainer();
    * Get List of ADF Faces SelectItem for an iterator binding.
    * Uses the value of the 'valueAttrName' attribute as the key for
    * the SelectItem key.
    * @param pIteratorName ADF iterator binding name
    * @param pValueAttrName name of the value attribute to use
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @return ADF Faces SelectItem for an iterator binding
    public static List<SelectItem> selectItemsForIterator(String pIteratorName, String pValueAttrName, String pDisplayAttrName)
    return selectItemsForIterator(findIterator(pIteratorName), pValueAttrName, pDisplayAttrName);
    * Get List of ADF Faces SelectItem for an iterator binding with description.
    * Uses the value of the 'valueAttrName' attribute as the key for
    * the SelectItem key.
    * @param pIteratorName ADF iterator binding name
    * @param pValueAttrName name of the value attribute to use
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @param pDescriptionAttrName name of the attribute to use for description
    * @return ADF Faces SelectItem for an iterator binding with description
    public static List<SelectItem> selectItemsForIterator(String pIteratorName, String pValueAttrName, String pDisplayAttrName, String pDescriptionAttrName)
    return selectItemsForIterator(findIterator(pIteratorName), pValueAttrName, pDisplayAttrName, pDescriptionAttrName);
    * Get List of attribute values for an iterator.
    * @param pIteratorName ADF iterator binding name
    * @param pValueAttrName value attribute to use
    * @return List of attribute values for an iterator
    public static List attributeListForIterator(String pIteratorName, String pValueAttrName)
    return attributeListForIterator(findIterator(pIteratorName), pValueAttrName);
    * Get List of Key objects for rows in an iterator.
    * @param pIteratorName iterabot binding name
    * @return List of Key objects for rows
    public static List<Key> keyListForIterator(String pIteratorName)
    return keyListForIterator(findIterator(pIteratorName));
    * Get List of Key objects for rows in an iterator.
    * @param pIterator iterator binding
    * @return List of Key objects for rows
    public static List<Key> keyListForIterator(DCIteratorBinding pIterator)
    List<Key> attributeList = new ArrayList<Key>();
    for (Row r: pIterator.getAllRowsInRange())
    attributeList.add(r.getKey());
    return attributeList;
    * Get List of Key objects for rows in an iterator using key attribute.
    * @param pIteratorName iterator binding name
    * @param pKeyAttrName name of key attribute to use
    * @return List of Key objects for rows
    public static List<Key> keyAttrListForIterator(String pIteratorName, String pKeyAttrName)
    return keyAttrListForIterator(findIterator(pIteratorName), pKeyAttrName);
    * Get List of Key objects for rows in an iterator using key attribute.
    * @param pIterator iterator binding
    * @param pKeyAttrName name of key attribute to use
    * @return List of Key objects for rows
    public static List<Key> keyAttrListForIterator(DCIteratorBinding pIterator, String pKeyAttrName)
    List<Key> attributeList = new ArrayList<Key>();
    for (Row r: pIterator.getAllRowsInRange())
    attributeList.add(new Key(new Object[]
    { r.getAttribute(pKeyAttrName) }));
    return attributeList;
    * Get a List of attribute values for an iterator.
    * @param pIterator iterator binding
    * @param pValueAttrName name of value attribute to use
    * @return List of attribute values
    public static List attributeListForIterator(DCIteratorBinding pIterator, String pValueAttrName)
    List attributeList = new ArrayList();
    for (Row r: pIterator.getAllRowsInRange())
    attributeList.add(r.getAttribute(pValueAttrName));
    return attributeList;
    * Find an iterator binding in the current binding container by name.
    * @param pName iterator binding name
    * @return iterator binding
    public static DCIteratorBinding findIterator(String pName)
    DCIteratorBinding iter = getDCBindingContainer().findIteratorBinding(pName);
    if (iter == null)
    throw new RuntimeException("Iterator '" + pName + "' not found");
    return iter;
    * @param pBindingContainer
    * @param pIterator
    * @return
    public static DCIteratorBinding findIterator(String pBindingContainer, String pIterator)
    DCBindingContainer bindings = (DCBindingContainer) JSFUtils.resolveExpression("#{" + pBindingContainer + "}");
    if (bindings == null)
    throw new RuntimeException("Binding container '" + pBindingContainer + "' not found");
    DCIteratorBinding iter = bindings.findIteratorBinding(pIterator);
    if (iter == null)
    throw new RuntimeException("Iterator '" + pIterator + "' not found");
    return iter;
    * @param pName
    * @return
    public static JUCtrlValueBinding findCtrlBinding(String pName)
    JUCtrlValueBinding rowBinding = (JUCtrlValueBinding) getDCBindingContainer().findCtrlBinding(pName);
    if (rowBinding == null)
    throw new RuntimeException("CtrlBinding " + pName + "' not found");
    return rowBinding;
    * Find an operation binding in the current binding container by name.
    * @param pName operation binding name
    * @return operation binding
    public static OperationBinding findOperation(String pName)
    OperationBinding op = getDCBindingContainer().getOperationBinding(pName);
    if (op == null)
    throw new RuntimeException("Operation '" + pName + "' not found");
    return op;
    * Find an operation binding in the current binding container by name.
    * @param pBindingContianer binding container name
    * @param pOpName operation binding name
    * @return operation binding
    public static OperationBinding findOperation(String pBindingContianer, String pOpName)
    DCBindingContainer bindings = (DCBindingContainer) JSFUtils.resolveExpression("#{" + pBindingContianer + "}");
    if (bindings == null)
    throw new RuntimeException("Binding container '" + pBindingContianer + "' not found");
    OperationBinding op = bindings.getOperationBinding(pOpName);
    if (op == null)
    throw new RuntimeException("Operation '" + pOpName + "' not found");
    return op;
    * Get List of ADF Faces SelectItem for an iterator binding with description.
    * Uses the value of the 'valueAttrName' attribute as the key for
    * the SelectItem key.
    * @param pIterator ADF iterator binding
    * @param pValueAttrName name of value attribute to use for key
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @param pDescriptionAttrName name of the attribute for description
    * @return ADF Faces SelectItem for an iterator binding with description
    public static List<SelectItem> selectItemsForIterator(DCIteratorBinding pIterator, String pValueAttrName, String pDisplayAttrName, String pDescriptionAttrName)
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r: pIterator.getAllRowsInRange())
    selectItems.add(new SelectItem(r.getAttribute(pValueAttrName), (String) r.getAttribute(pDisplayAttrName), (String) r.getAttribute(pDescriptionAttrName)));
    return selectItems;
    * Get List of ADF Faces SelectItem for an iterator binding.
    * Uses the value of the 'valueAttrName' attribute as the key for
    * the SelectItem key.
    * @param pIterator ADF iterator binding
    * @param pValueAttrName name of value attribute to use for key
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @return ADF Faces SelectItem for an iterator binding
    public static List<SelectItem> selectItemsForIterator(DCIteratorBinding pIterator, String pValueAttrName, String pDisplayAttrName)
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r: pIterator.getAllRowsInRange())
    selectItems.add(new SelectItem(r.getAttribute(pValueAttrName), (String) r.getAttribute(pDisplayAttrName)));
    return selectItems;
    * Get List of ADF Faces SelectItem for an iterator binding.
    * Uses the rowKey of each row as the SelectItem key.
    * @param pIteratorName ADF iterator binding name
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @return ADF Faces SelectItem for an iterator binding
    public static List<SelectItem> selectItemsByKeyForIterator(String pIteratorName, String pDisplayAttrName)
    return selectItemsByKeyForIterator(findIterator(pIteratorName), pDisplayAttrName);
    * Get List of ADF Faces SelectItem for an iterator binding with discription.
    * Uses the rowKey of each row as the SelectItem key.
    * @param pIteratorName ADF iterator binding name
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @param pDescriptionAttrName name of the attribute for description
    * @return ADF Faces SelectItem for an iterator binding with discription
    public static List<SelectItem> selectItemsByKeyForIterator(String pIteratorName, String pDisplayAttrName, String pDescriptionAttrName)
    return selectItemsByKeyForIterator(findIterator(pIteratorName), pDisplayAttrName, pDescriptionAttrName);
    * Get List of ADF Faces SelectItem for an iterator binding with discription.
    * Uses the rowKey of each row as the SelectItem key.
    * @param pIterator ADF iterator binding
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @param pDescriptionAttrName name of the attribute for description
    * @return ADF Faces SelectItem for an iterator binding with discription
    public static List<SelectItem> selectItemsByKeyForIterator(DCIteratorBinding pIterator, String pDisplayAttrName, String pDescriptionAttrName)
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r: pIterator.getAllRowsInRange())
    selectItems.add(new SelectItem(r.getKey(), (String) r.getAttribute(pDisplayAttrName), (String) r.getAttribute(pDescriptionAttrName)));
    return selectItems;
    * Get List of ADF Faces SelectItem for an iterator binding.
    * Uses the rowKey of each row as the SelectItem key.
    * @param pIterator ADF iterator binding
    * @param pDisplayAttrName name of the attribute from iterator rows to display
    * @return List of ADF Faces SelectItem for an iterator binding
    public static List<SelectItem> selectItemsByKeyForIterator(DCIteratorBinding pIterator, String pDisplayAttrName)
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r: pIterator.getAllRowsInRange())
    selectItems.add(new SelectItem(r.getKey(), (String) r.getAttribute(pDisplayAttrName)));
    return selectItems;
    * Find the BindingContainer for a page definition by name.
    * Typically used to refer eagerly to page definition parameters. It is
    * not best practice to reference or set bindings in binding containers
    * that are not the one for the current page.
    * @param pPageDefName name of the page defintion XML file to use
    * @return BindingContainer ref for the named definition
    private static BindingContainer findBindingContainer(String pPageDefName)
    BindingContext bctx = getDCBindingContainer().getBindingContext();
    BindingContainer foundContainer = bctx.findBindingContainer(pPageDefName);
    return foundContainer;
    * @param pOpList
    public static void printOperationBindingExceptions(List pOpList)
    if (pOpList != null && !pOpList.isEmpty())
    for (Object error: pOpList)
    _LOGGER.severe(error.toString());
    * Programmatic invocation of a method that an EL evaluates to.
    * The method must not take any parameters.
    * @param pEl EL of the method to invoke
    * @return Object that the method returns
    public static Object invokeEL(String pEl)
    return invokeEL(pEl, new Class[0], new Object[0]);
    * Programmatic invocation of a method that an EL evaluates to.
    * @param pEl EL of the method to invoke
    * @param pParamTypes Array of Class defining the types of the parameters
    * @param pParams Array of Object defining the values of the parametrs
    * @return Object that the method returns
    public static Object invokeEL(String pEl, Class[] pParamTypes, Object[] pParams)
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ELContext elContext = facesContext.getELContext();
    ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
    MethodExpression exp = expressionFactory.createMethodExpression(elContext, pEl, Object.class, pParamTypes);
    return exp.invoke(elContext, pParams);
    * Sets the EL Expression with the value.
    * @param pEl EL Expression for which the value to be assigned.
    * @param pVal Value to be assigned.
    public static void setEL(String pEl, Object pVal)
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ELContext elContext = facesContext.getELContext();
    ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
    ValueExpression exp = expressionFactory.createValueExpression(elContext, pEl, Object.class);
    exp.setValue(elContext, pVal);
    * Evaluates the EL Expression and returns its value.
    * @param pEl Expression to be evaluated.
    * @return Value of the expression as Object.
    public static Object evaluateEL(String pEl)
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ELContext elContext = facesContext.getELContext();
    ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
    ValueExpression exp = expressionFactory.createValueExpression(elContext, pEl, Object.class);
    return exp.getValue(elContext);
    }

  • Pageless Managed beans and operation bindings, design question

    Hi,
    I am using ADF Faces and ADF BC and JDev 10.1.3.
    I want to declaratively execute an operation binding from a managed bean which does not have a page definition.
    How can I create a page definition for a managed bean which will allow me to define and call operation bindings in the same way that you can in a backing bean?
    In the past I have used the binding layer to get references to the AM and then execute the client methods directly.
    How can I do this declaratively from a managed bean?
    regards,
    Brenden

    Hi Steve,
    a good example would be a managed bean which is used by many pages for provide dynamic page forwarding (using global forwards).
    The page forwarding is based on what data the user has selected and the entry tasklist will have pages added and removed based on the users entered information.
    At the moment I use references in the managed bean which get the binding context by evaluating #{data} to get a reference to the AM and directly call an client method, which calls a PL/SQL procedure and returns a global forward string. The AM is imported into the managed bean and methods called directly.
    This is just one example, but probably the best I can come up with for now.
    In a backing bean I can use an operation binding to call a method and get a result declaratively like this:
            BindingContainer bindings  = getBindings();
            OperationBinding operation = bindings.getOperationBinding("getUserByEmail");
            operation.getParamsMap().put("email", email);
            String userName = (String)operation.execute();whereas in a managed bean I have to get direct references to the AM to call the method directly.
    if there is a way to do this in the same way as backing beans it would seem a more abstracted and cleaner approach?
    regards,
    Brenden

  • Identical view but different managed beans?

    Hi everyone,
    We have a situation where we have jsf code that is identical for 2 different pages, except that the managed bean(backing bean) is different. We are having to duplicate the jsf code just because of this. It would be much easier to maintain if we could share the jsf code between the two beans(and somehow have it use the backing bean that it needs to use at the right time). Is there a way to do this?
    Thanks in advance!
    -M

    This code is part of a component that allows users to input their address(add page). On another page(settings page), where the user sets defaults for the system, the exact same code is needed for them to set their default address.
    When the user goes to the add page, this default address is populated, the user can continue using the default or change it.
    Hope this makes sense. Thanks.

  • Managed bean configuration

    Hi experts,
    In which two places do you configure managed beans?
    A. In the page definition file
    B. In the faces-config.xml file
    C. In the adfc-config.xml file
    D. In the Property Inspector
    E. In the task flow definition files
    Thanks

      In the faces-config.xml file
    . In the adfc-config.xml file

  • 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 pop up a browser window from a managed bean?

    I have a user case like this:
    User login our home website. He/she clicks a button. Control flow goes to a managed bean (MB here after) to check some conditions. If conditions are met, instead of sending the user back to the home page, the user will be presented a new web site (e.g. forums.oracle.com) in a popup window on top of our home site.
    Can we invoke a website in a adf popup? If so, how to do that? If not, any idea on how to develop this use case?
    Any idea is appreciated.

    Sorry, I have updated the previous reply with the required inputs.
    For convenience, putting it again;
    if you need to check for some condition and then invoke the browser, you could use the following code in your managed bean for af:commandButton for Action.
    import javax.faces.context.FacesContext;
    import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;
    public class TestURLPageBean {
    public TestURLPageBean() {
    super();
    public String onClick() {
    *// Check for the condition here and invoke the browser only if it is true*
    if (true) {
    ExtendedRenderKitService erks =
    (ExtendedRenderKitService)Service.getRenderKitService(FacesContext.getCurrentInstance(),
    ExtendedRenderKitService.class);
    StringBuilder script = new StringBuilder();
    script.append("window.open('http://www.google.com');");
    erks.addScript(FacesContext.getCurrentInstance(),
    script.toString());
    return null;
    Thanks,
    Navaneeth

Maybe you are looking for

  • NullPointerException received on creating webservice from wsdl with jdevel

    Hello experts, I have the following problem when trying to create a web service from a wsdl file: java.lang.NullPointerException      at oracle.jdevimpl.webservices.wizard.jaxrpc.common.SpecifyWsdlPanel.fetchWSDL(SpecifyWsdlPanel.java:1054)      at o

  • SSIS Project Deploy issues

    Dear experts, I have a weird issue with project deployment on SSIS catalog. (2012) Everything was fine until yesterday, i could deploy using SSDT or the wizard as well using the SSISDB procedure. (nothing happen meanwhile) Now none of them are workin

  • What to do with "Update is not applicable" error when install the InCopy 7.0.5.562 patch on window?

    Hi, I had InCopy 7.0.0.354 window version, and would like to upgrade to newer version. After install the InCopy 7.0.5.652 patch, there is this "Update is not applicable" error. The InDesign 7.0.5.652 patch installs (my old InDesign is 7.0.0.354) with

  • 2 weeks and already Disappointed

    First off I miss not having Picture in Picture. Can someone tell me when that will be available. I have two DVR STB. Next I hope the guide is changed to remove the distracting info tab that sits right in the middle of the screen and gives info on whi

  • Agent Collection disabled by upload manager - how to enable it

    Hi I am using EM grid control agent 10.2. The upload is disabled in my machine.how to enable it? and the agent is UP for a few minutes and goes DOWN again. Can anyone help me on this please? Thanks and Regards C:\>emctl status agent Oracle Enterprise