Build a ui component from the backing bean 2

This is a related question to one I just posted:
So, I'm trying to build ui components programmatically. In particular, I'm tyring to build af:selectBooleanCheckBox(es), using af:foreach loop. However, to know how many to output I need some information from the database. I query the database in the application module and build an array from the resulting query. I return this array from my method. Now in my backing bean, I want to invoke this method so I can get the array. I'll use tihs array in my jsp page to output the UI component. When I try to instantiate the function in the constructor of my backing bean, I get an error. So I'm planning to use invokeAction to run my method automatically on page load. However, if I do this, how do I get back my array? Where is it stored?
Also, is it possible to make my array available to my jsp page without going through my backing bean?
Thanks in advance.

Hi, it would help if you tell us the jdev version you are using. I assume you use adf rich faces?
As a general rule, you can't put this kind of code in the constructor.
I would use a bounded task flow and put call a bean method as default task inside it.
Timo

Similar Messages

  • How to Add error message for component from the baking bean

    I am in the situation, I need to add the h:message message component for each component at the time I am looking for an easy process something like I have to add the error message at the bean side, here I am using component binding approach but I am not able to add child for input Text components at the bean side, actually my final target is to add the message for each component when ever they get error and I have to change the style also.....
    So please anybody help me......

    Thanks for the response but one more thing right now I can't add message tag for each component so that I can add message from the baking bean as per ur solution I tried like this
    FacesMessage msg = new FacesMessage("Testing is going");
    msg.setSeverity(FacesMessage.SEVERITY_ERROR);
    FacesContext.getCurrentInstance().addMessage(tf_ADD1.getId(), msg);
    it is working but it is showing on the top of the for even no problem but I need to change the component color based on the message but I am not able to achieve that so how can I do that from backing bean now I can't add tags for each component.
    So please show me a way.

  • How to call a query from the backing bean ?

    Hi all,
    Another question for you guys :
    I made a jspx page with an input form and a submit button.
    When I click the submit button, the action my_action in my backing bean is executed.
    This is the code :
    public BindingContainer getBindings() {
    return BindingContext.getCurrent().getCurrentBindingsEntry();
    public String my_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("EmployeesView");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    I hoped that the query 'EmployeesView' was executed in this way, but I get the following exception :
    java.lang.ClassCastException: oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding cannot be cast to oracle.binding.OperationBinding
    So how should I execute the query EmployeesView ?
    Second part of the question : What if I typed the name an employee in my form, and I want to
    execute a query that selects all the Employees with that name ?
    How do I make a query with a variable as input in the WHERE clause ?
    Thanks in advance.
    Edited by: Facehugger on 7-apr-2010 11:15

    I'm still trying all the stuff you guys says, but still no result.
    This is my backing bean :
    +// the button action+
    +public String my_action()  {+ 
    +// get the selected rows from the multiselect table and store the objectid's in an String array+
    RowKeySet rks = graph_table.getSelectedRowKeys();
    Iterator itr = rks.iterator();
    Object key;
    int nbr_objects = 0 , i = 0;
    if (rks.size()>0)  nbr_objects = rks.size();
    +String[] objectid = new String[nbr_objects];+
    while(itr.hasNext())
    +{+
    key = itr.next();
    graph_table.setRowKey(key);
    Object o = graph_table.getRowData();
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding) o;
    Row row = rowData.getRow();
    +objectid[i] = row.getAttribute("Objectid").toString();+
    i+;+
    +}+
    +// now get all the x and y values for these objectid's from the database out of the table history.+
    BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
    for (int j=0 ; j<nbr_objects; j+){+
    +// get X and Y values for object number j+
    DataPoints history = new DataPoints();
    OperationBinding operationBinding = bc.getOperationBinding("retrieveHistory");   ===> operationBinding stays NULL ???+
    +operationBinding.getParamsMap().put("OBJECTID", objectid[j]);+
    Object retVal = operationBinding.execute();
    +// ==> retVal should contain a List of all X and Y values for the provided objectid.+
    +// while (retVal has values)+
    +// {+
    +// List_of_x_values.add(retVal.valueX);+
    +// List_of_y_values.add(retVal.valueY);+
    +// }+
    history.add(List_of_x_values);
    history.add(List_of_y_values):
    +// call the soap method to do some calculations+
    methodname.forecast(history);
    +}+
    +}+
    In my application module :
    public void retrieveHistory(String objectid) {
    getHistory().setWhereClause("OBJECTID = '" + objectid + "'");
    System.out.println("current query : "+getHistory().getQuery());
    getHistory().executeQuery();
    public ViewObjectImpl getHistory() {+
    return (ViewObjectImpl)findViewObject("History");+
    The query for the VO History : SELECT * FROM HISTORY
    Please anyone ?
    Edited by: Facehugger on 9-apr-2010 14:19

  • SelectOneMenu does not show the data from the backing bean

    Here is my code:
    <!--
    Fetch the source directory
    -->
    <h:inputText id="dir"
    value="#{myBean.sourceDirectory}"/>
    <!--
    Click this button to refresh the sub-directories list below
    -->
    <h:commandButton value="fetch"
    actionListener="#{myBean.processFetch}" />
    <!--
    Show the list of sub-directories in the directory entered above as a drop
    down
    -->
    <h:selectOneMenu value="#{myBean.selection}">
    <f:selectItems value="#{myBean.dirs}"/>
    </h:selectOneMenu>
    public class MyBean{
    private String sourceDirectory;
    private ArrayList<SelectItem> dirs;
    public String getSourceDirectory(){
    return sourceDirectory;
    public void setSourceDirectory(String newDir){
    this.sourceDirectory = newDir;
    public ArrayList<SelectItem> getDirs(){
    return dirs;
    public void setDirs(ArrayList<SelectItem> newDirs){
    this.dirs = newDirs;
    public void processFetch(ActionEvent e){
    //For this example, we return some hard coded values
    dirs = new ArrayList<SelectItem>();
    SelectItem s1 = new SelectItem();
    s1.setLabel(sourceDir + "_1");
    SelectItem s2 = new SelectItem();
    s2.setLabel(sourceDir + "_2");
    SelectItem s3 = new SelectItem();
    s3.setLabel(sourceDir + "_3");
    SelectItem s4 = new SelectItem();
    s4.setLabel(sourceDir + "_4");
    dirs.add(s1);
    dirs.add(s2);
    dirs.add(s3);
    dirs.add(s4);
    When I run the above code, I notice that the first time, (and the only time), if I hit the "fetch" button the data in the drop-down menu does get refreshed.
    Subsequently, it does not change. I am not sure what I am doing wrong.
    Can someone help me?

    Hi,
    In order to use the JDBC persistence store you have to use a non XA JDBC driver for your Data Source.
    http://docs.oracle.com/cd/E23943_01/web.1111/e13701/store.htm#CNFGD221
    Point-13). When configuring a connection pool to use with WebLogic JMS JDBC Store, use non-XA database drivers.
    http://middlewaremagic.com/weblogic/?p=586
    Hope it helps

  • How to get a value for Select One Choice in the backing bean

    Friends,
    Does any one have any idea, how to get the value of a selected item value from the Select One Choice component in the backing bean iin valueChangeListener method. Right now I am always getting the sequence of the selected item, instead the actual selected value. I tried using 'ValuePassTrhough=true' also.. but didn't help
    Below is the my code snippet
    <af:selectOneChoice value="#{bindings.country.inputValue}"
    required="#{bindings.country.hints.mandatory}"
    shortDesc="#{bindings.country.hints.tooltip}"
    id="soc1" autoSubmit="true" valuePassThru="true"
    valueChangeListener="#{pageFlowScope.Bean.onValueChange
    <f:selectItems value="#{bindings.country.items}" id="si2"/>
    </af:selectOneChoice>
    Thanks in advance.

    check my other post at Re: Pass data from a variable to another page

  • Add UIComponents to the page via the backing bean

    Is it possible to add a UIComponent to my page (Page1.jsp) from the backing bean (Page1.java)?
    For example:
    public class Page1 extends AbstractPageBean {
      public Page1() {
        HtmlPanelGroup panel = new HtmlPanelGroup();
        this.page.getChildren().add(panel);  //<-- doesn't work
    }

    Hi Lexicore:
    I'm new to JSF and tried to utilize your example - with no success (see below)...
    I assume I took your suggestion to literally.
    Please tell me what is missing.
    ****jsp page: jsp1.jsp****
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <html>
    <f:view>
    <head>
    <title>jsp1</title>
      <link rel="stylesheet" type="text/css" href="./style.css" title="Style"/>
    </head>
    <body bgcolor="#ffffff">  TESTING...
      <h:form id="form1">
        <h:panelGrid id="panelgridtest" binding="#{jsp1Bean.component}"/>
      </h:form>
    </body>
    </f:view>
    </html>
    ****backing bean: "Jsp1Bean.java" ****
    package test;
    import javax.faces.application.*;
    import javax.faces.component.*;
    import javax.faces.component.html.*;
    import javax.faces.context.*;
    import javax.faces.el.*;
    public class Jsp1Bean
        protected UIComponent component;
        public Jsp1Bean()
            component = new UIPanel();
        public UIComponent getComponent()
            return component;
        public void setComponent(UIComponent component)
            this.component = component;
    //initialization block
            try
                FacesContext facesContext = FacesContext.getCurrentInstance();
                UIViewRoot uIViewRoot = facesContext.getViewRoot();
                Application application = facesContext.getApplication();
    //outputText1
                HtmlOutputText outputText1 = (HtmlOutputText) facesContext.getApplication().createComponent(HtmlOutputText.COMPONENT_TYPE);
                outputText1.setValue("---the outputText1 value---");
    //inputText1
                HtmlInputText inputText1 = (HtmlInputText) facesContext.getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);
                inputText1.setValue("---the inputText1 value---");
    //add outputText1 and inputText1 to component ("UIPanel")
                component.getChildren().add(outputText1);
                component.getChildren().add(inputText1);
            catch (java.lang.Throwable t)
                System.out.println("java.lang.Throwable exception encountered...t.getMessage()=" + t.getMessage());
                t.printStackTrace();
        public String doAction()
            return "submit";
    ****faces-config.xml****
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
      <navigation-rule>
        <from-view-id>/jsp1</from-view-id>
        <navigation-case>
          <from-action>submit</from-action>
          <to-view-id>/jsp1</to-view-id>
          <redirect/>
        </navigation-case>
      </navigation-rule>
      <managed-bean>
        <managed-bean-name>jsp1Bean</managed-bean-name>
        <managed-bean-class>test.Jsp1Bean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </faces-config>
    **** Error Message I receive from trying to run ****
    Nov 5, 2004 5:05:03 PM org.apache.catalina.core.StandardHostDeployer install
    INFO: Installing web application at context path /test from URL file:C:\tomcat\webapps\test
    Nov 5, 2004 5:05:09 PM org.apache.catalina.core.StandardHostDeployer install
    INFO: Installing web application at context path /tomcat-docs from URL file:C:\tomcat\webapps\tomcat-docs
    Nov 5, 2004 5:05:09 PM org.apache.catalina.core.StandardHostDeployer install
    INFO: Installing web application at context path /webdav from URL file:C:\tomcat\webapps\webdav
    Nov 5, 2004 5:05:10 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8084
    Nov 5, 2004 5:05:10 PM org.apache.jk.common.ChannelSocket init
    INFO: JK2: ajp13 listening on /0.0.0.0:8012
    Nov 5, 2004 5:05:10 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=15/234  config=c:\tomcat\conf\jk2.properties
    Nov 5, 2004 5:05:10 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 16656 ms
    java.lang.Throwable exception encountered...t.getMessage()=null
    java.lang.NullPointerException
            at test.Jsp1Bean.<init>(Unknown Source)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
            at java.lang.Class.newInstance0(Class.java:308)
            at java.lang.Class.newInstance(Class.java:261)
            at java.beans.Beans.instantiate(Beans.java:204)
            at java.beans.Beans.instantiate(Beans.java:48)
            at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:204)
            at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:253)
            at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:78)
            at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
            at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:146)
            at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
            at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
            at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
            at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:389)
            at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:1018)
            at javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1045)
            at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:742)
            at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:423)
            at com.sun.faces.taglib.html_basic.PanelGridTag.doStartTag(PanelGridTag.java:442)
            at org.apache.jsp.jsp1_jsp._jspx_meth_h_panelGrid_0(jsp1_jsp.java:152)
            at org.apache.jsp.jsp1_jsp._jspx_meth_h_form_0(jsp1_jsp.java:131)
            at org.apache.jsp.jsp1_jsp._jspx_meth_f_view_0(jsp1_jsp.java:101)
            at org.apache.jsp.jsp1_jsp._jspService(jsp1_jsp.java:62)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

  • Redirect from JSF backing bean to another application

    Hi,
    I need to open another (non-JSF) application in a new window from the backing bean of my JSF application.
    My JSF application is in frames. - heading, menu, content.
    I've a commandlink in the menu frame.
    I tried with
    FacesContext.getCurrentInstance().getExternalContext().redirect(loginUrl);
    This is opening in the menu frame itself.
    I tried using target="new" , but no result.
    I also need to pass the userId to the external application.
    Any ideas?
    ~Thanks.

    Thanks.
    Yes, GET works. I used a <h:outputLink and used target="new" and
    window.open("url?userId=someId")
    But i donot want to pass userid in GET in the url, since that is a sensitive information.
    Please let me know if there's any other way.
    Thanks,

  • How to get specific rows from the vo or Iterator in the backing bean?

    Hi,
    I have to get the specific number of rows from iterator in the backing bean. means i want to get the records from the VO or Iterator only from 5 th record to 10th record its like rownum in SQL.
    We can use rownum in VO sql query. but there would be a performance issue with that ...
    SO i am trying to get the rows from ADF Iterator once we fetch from DB.
    Is it possible to do that ?
    Do we have any way to set the pointer to the VO/Iterator like setFirst() and after that setMaxResult to retrun the rows between first and maxresult..
    Thanks

    If this is for pagination, then af:table offers pagination by design when you set accessmode=RangePaging or RangePagingIncremental in VO. Paginated queries are fired when scroll down in the table. Explore this option before you try out any custom solution
    To answer the question,
    Note: same logic i have implpemented ADF with EJB ..In EJB Query class we have setFirst(int) and setMaxResult(int) methods...simply i did setFirst(30) and setMaxResult(10)..It worked fine...Theoretically speaking the same can be achieved by setting setRangeStart() on the viewobject(which in turn sets to the default rowset) and by setting max fetch size on VO + accessmode=RangePaging. However when you use table with ADF binding, these will be overridden by the binding layer. If you are not using ADF binding, then the above is same as what you did for JPA entity. Other option is, you build expert mode VO with rownum for this special case, which will work if you dont need to set accessmode=RangePaging for VO.

  • The difference in calling an application module from a backing bean

    Hello everybody!
    I don't understand exactly, where is the difference in calling an application module from a backing bean in the following ways.
    Example 1
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{data}");
    BindingContext bc = (BindingContext)vb.getValue(context);
    DCDataControl dc = bc.findDataControl("AppModuleDataControl");
    AppModuleImpl appModule = (AppModuleImpl)dc.getDataProvider();Example 2
    String amDef = "model.services.AppModule";
    String config = "AppModuleLocal";
    AppModuleImpl appModule = (AppModuleImpl)Configuration.createRootApplicationModule(amDef, config);Example 3 (the same like Example 1???)
    String EL = "#{data.AppModuleDataControl.dataProvider}";
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding(EL);
    AppModuleImpl appModule = (AppModuleImpl)vb.getValue(fc);Please can anybody explain, what the three examples do? Which example is preferred to call an application-module-method from a backing bean?
    Thanks and regards
    Majo
    Edit: I am using ADF BC 10g in JDev10 :)

    Hi :)
    >
    This could work, but can you describe the use case for which you need to get the ApplicationModule?
    Maybe we can find a better way to implement your functionality.
    >
    Sure, i know a lot of better ways to implement the same functionality too but its a huge project, its not my code and we have no time to reimplement this functions ;)
    Frank, i don't understand the first line of your code.
    DCBindingContainer bindings = ... resolve #{bindings}Where do i get the bindingContainer, if I don't have the "JSFUtils"- or "ADFUtils"-classes?
    Regards
    Majo
    Edit:
    Sorry, i have answer, before i think about it ;)
    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    DCBindingContainer bindings = (DCBindingContainer)app.getVariableResolver().resolveVariable(context, "bindings");
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();or in my backing bean, when i add the property to the faces-config.xml
    DCBindingContainer bindings = this.getBindings();
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();Is this right?

  • ADF-BC/JSF How to display acustom error message from a backing bean

    Hi all
    Can anybody provide an example of how to manipulate the list of error messages from a JSF backing bean.
    In my code I use a different navigation case and this directs the user to the page displaying the error message but I am sure that there must be a more elegant way.
    Thanks in advance
    Thanassis

    Thanks Kris
    I think you 've put me on the right track here, it's just that in my case what I really want to do is prevent my users from editing records not belonging to their own group. This is done via a selectOne table component and then the backing bean code tests if the value #{row.UserGroup} matches the #{bindings.LoggedOnUserGroup.inputValue}. If the values are equal then the beans returns the navigation case to the edit page. Otherwise it returns the navigation case for the "cannot edit" page.
    So what I am thinking is to return null and somehow raise the right kind of exception in order to display the error in the af:messages tag.
    Thanassis

  • How to set values in a CoreTable programmatically from a backing bean

    Hi,
    One of the columns in my CoreTable is "af:inputText" field, I need to set the value of inputText field in each row from a backing bean.
    I have bound this table to a component in the bakcing bean and in the setMyCoreTable method I'm also preselecting certain rows. For all the preselected rows I need to set a value in the inputText field.
    Can someone point me to some code samples or give me some ideas to solve this.
    Thanks

    Thanks dvohra,
    I looked at the post you suggested yesterday, but I wasnt sure how I can implement that in my case.
    Since Im programatically preselecting certain rows in the setMyCoreTable method(which is the accessor method), I was hoping I could prepopulate the input text field as well in the same method.
    For your reference below is the code from jspx and the backing bean.
    <af:table value="#{bindings.ProgramComponentList.collectionModel}"
    var="row"
    rows="#{bindings.ProgramComponentList.rangeSize}"
    first="#{bindings.ProgramComponentList.rangeStart}"
    emptyText="#{bindings.ProgramComponentList.viewable ? 'No rows yet.' : 'Access Denied.'}"
    selectionState="#{bindings.ProgramComponentList.collectionModel.selectedRow}"
    selectionListener="#{bindings.ProgramComponentList.collectionModel.makeCurrent}"
    binding="#{backing_EditProgramBean.compsTableComponent}">
    <af:column sortProperty="Name" sortable="true"
    headerText="#{bindings.ProgramComponentList.labels.Name}">
    <af:outputText value="#{row.Name}"/>
    </af:column>
    <af:column sortProperty="Description" sortable="true"
    headerText="#{bindings.ProgramComponentList.labels.Description}">
    <af:inputText value="#{row.Description}" simple="true"
    required="true"
    columns="30"/>
    </af:column>
    <f:facet name="selection">
    <af:tableSelectMany id="tableSelectMany1"/>
    </f:facet>
    </af:table>
    CODE FROM BACKING BEAN ---------
    public void setCompsTableComponent(CoreTable compsTableComp) {
    ManageProgramsServiceImpl serviceImpl =
    (ManageProgramsServiceImpl)JSFUtils.get("#{bindings.ProgramDetailIterator.dataControl.dataProvider}");
    ViewObject searchProgramView = serviceImpl.findViewObject("SearchProgramView");
    Row currProgram = searchProgramView.getCurrentRow();
    ViewObject view = serviceImpl.findViewObject("ProgramComponents");
    view.setWhereClause("ProgramsComponents.PROGRAM_ID = " + currProgram.getAttribute("ProgramId"));
    view.executeQuery();
    view.setRangeSize(view.getRowCount());
    view.executeQuery();
    Row[] programComponents = view.getAllRowsInRange();
    RowKeySet rks = new RowKeySet();
    ViewObject compTypesView = serviceImpl.findViewObject("ProgramComponentList");
    compTypesView.setRangeSize(compTypesView.getRowCount());
    compTypesView.executeQuery();
    Row[] compTypes = compTypesView.getAllRowsInRange();
    for (int i = 0; i < compTypes.length; i++) {
    String code = compTypes.getAttribute("Code").toString();
    for(int j=0; j<programComponents.length; j++){
    String programCode = programComponents[j].getAttribute("ComponentType").toString();
    if(programCode.equalsIgnoreCase(code)){
    rks.getKeySet().add(compTypes[i].getKey());
    compsTableComp.setSelectionState(rks);
    List li = compsTableComp.getChildren();
    System.out.println("****** li : " + li.size());
    //System.out.println("****** row count : " + compsTableComp.getRowCount());
    //System.out.println("****** count : " + compsTableComp.getRows());
    this.compsTableComponent = compsTableComp;
    The table children size(li.size()) comes up as zero and [compsTableComp.getRowCount()] gives an exception. Can you please provide any help. Seems like Im off track with this whole thing.
    Thanks

  • Database access from Managed/Backing bean

    Hi,
    I would like to authenticate web users from a database table, I get the account details
    in the Welcome page, I wish to check if the user exists in the table (from the managed bean), how do I do this?
    Is this good practice to access the db from managed bean? If not how do I do this in model component and pass the value back and forth from managed bean?
    Thanks,
    Jai.

    Hi
    You can get all the information of logged in user from SecurityContext(you can get this either from ADFContext using ADFContext.getCurrent().getSecurityContext() or using EL expression eg. #{securityContext.userName} shows logged in user name)
    API: http://download.oracle.com/docs/cd/E15051_01/apirefs.1111/e10686/oracle/adf/share/security/SecurityContext.html#method_summary
    More details on enabling security: http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/adding_security.htm#BGBCEDDD
    Sireesha

  • Applying viewcriteria inside the backing bean

    Hi Experts,
    Currently i am building one table based on the View object. In that view object i have an attribute which returns true or false.
    My requirement in the page i need to have a check box and if the user selects the check box then i need to show the records where the attribute is true. In case of check box deselection then i need to show all the entries (please note not the entries where the attribute value is false)
    So i have created one view criteria in the view object and handled the checked box selection inside my backing bean. However it seems the criteria is not apply to the model. Any idea? or any other way i can implement this.
    Apart from this i tried the checked box inside the column filter facet. However the issue is if check box is selected then that filters only true entries. deselected then the false entries. If i use the drop down list then i can implement my requirement without any issue.
    -t
    here the code segment
    DepartmentVOImpl securityCompVO =
    (DepartmentVOImpl )findDataControl("ManageDepartmentAMDataControl").getApplicationModule().findViewObject("DepartmentVO1");
    if (selected) {
    //Apply the criteria
    ViewCriteria criteria =
    departmentVO.getViewCriteriaManager().getViewCriteria("DepartmentVOCriteria");
    criteria.setProperty(ViewCriteriaHints.CRITERIA_AUTO_EXECUTE, Boolean.TRUE);
    departmentVO.applyViewCriteria(criteria);
    departmentVO.executeQuery();
    } else {
    //remove the criteria
    departmentVO.removeApplyViewCriteriaName("DepartmentVOCriteria");
    departmentVO.executeQuery();
    Util.refreshComponent(richTable);

    User,
    I would personally not like this code.
    You should not get access to the AM in the view layer.
    What i would advice you to do is from your backing bean call an AM service method passing the checkbox value (selected or not) . In the Service method get access to the VO and then apply the viewcritera using VO.setApplyViewCriteria() and finally reexecute the VO.

  • Is it possible to call a custom method in App Module from a backing bean?

    I would like to know if a custom method in App Module can be called from inside a backing bean.
    I am not sure if it is logically right to call, from a backing bean, a custom method in App Module. But would like to know if that makes sense or if it is possible.

    Hi..
    Yes it is possible.You have to add that method for client interface of AppModule.Now you can see that method in Data Controls(Refresh the data control). To call this method using bean it should add as method action to bindings(Click Bindings>+>methodAction>and Create action binding).
    Now you can call this method in bean class.
    Check following example use this concept to execute view criteria
    http://adf-lk.blogspot.com/2011/05/oracle-adf-create-view-criteria-and_4727.html

  • Is there a way to get a (return) value back after running Javascript statements in the backing bean?

    I have a usecase  where I need to run a javascript function from within the backing bean and get the value returned by the function.
    Example:
              In Java I have two variables  x and y, I want the javascript to return the larger value z.
              This is what I'm doing, but I have no means to get the values of variable z.
              StringBuilder script = new StringBuilder();
              script.append("var  z;");
              script.append("var  x = " + x + ";");
              script.append("var  y = " + y + ";");
              script.append("if  (x > y)  z = x  else z = y");
              FacesContext fctx = FacesContext.getCurrentInstance();
              ExtendedRenderKitService erks = Service.getRenderKitService(fctx,
              ExtendedRenderKitService.class); erks.addScript(fctx, script);
         The actual usecase is a bit complicated. It's a dragNdrop paradigm.
         I cannot capture the muse Release event (DropEvent ?) in the client side as (most likely) it is captured by ADF.
         The drop target is a RichTextEditor. I need to convert the DropEvent.getDropX() and DropEvent.getDropY() to get the caret position in the text editor.
    Any other solution to the issue is highly appreciated.
    Thanks,
    -ab

    you can try it!
    erks.addScript(fctx, js_funcation_name("'"+x+"'","'"+y+"'","'"+x+"'","'"+x+"'",.....));//bean-> javaScript
    add javascript:
                   AdfCustomEvent.queue(p, 'XXXXX', {parameter:parameter_value},true);
    add:
    <af:serverListener type="XXXXX" method="#{ManageBean.funcation}"/>//js->bean

Maybe you are looking for

  • Hinance: automated personal bookkeeping for hackers

    I've been doing bookkeeping in my family for a few years using a variety of tools. Unfortunatelly, neither of them had a combination of features I wanted, which is: showing actual vs. planned expenses by categories; automated data import from banks a

  • Format changing when exporting to Numbers on Mac

    I export to itunes for use in Numbers 09 for Mac. The file opens ok, but my legal sized page is reverted to a letter sized page; sometimes other formatting is changed as well. Please fix.

  • ISO DVD w/ multiple extents on Solaris sparc 9

    I've created a ISO DVD, (mode 1, 8.3 names, etc..) that contains several files, one of which has multiple extents. This disc does not have rock ridge info on it. This disc mounts and reads fine on linux and on WinXP, but on Solaris Sparc 9 the file t

  • Java Stored Performance

    I was wondering if there is any applied techniques/best practices for enhancing the performance of the "first java call" per session.

  • PLM-CPR Multilevel Controlling (Structure Elemen, Automatic) :: WBS

    We use Multilevel Controlling (Structure Elemen, Automatic) controlling method for automatic cProjects project transfer in PS projects. We need WBS element key (PRPS-POSID) would be transferted from a cProject field with external number (user field o