Binding parameters in backing bean

hey,
i have a function func1(String str) with a parameter
in my bb i use code to invoke the function:
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("func1");
operationBinding.execute();
how can i bind parameter in backing bean?

hi user,
+ with,
here some
your bean
  public class Login  {
    private RichInputText it2;
    private RichInputText it1;
public void setIt2(RichInputText it2) {
        this.it2 = it2;
    public RichInputText getIt2() {
        return it2;
    public void setIt1(RichInputText it1) {
             this.it1 = it1;
    public RichInputText getIt1() {
               return it1;
BindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("checkLoginCredentials1");
        operationBinding.getParamsMap().put("p_user", it2);    p_user - bind var
        operationBinding.getParamsMap().put("p_pwd", it1);    p_pwd - bind var
} your method in am:
    public String checkLoginCredentials1(String p_user, String p_pwd) {
        /*set the bind variable value*/
        vo.setNamedWhereClauseParam("p_user", p_user.toUpperCase());
        vo.setNamedWhereClauseParam("p_pwd", p_pwd.toUpperCase());
        return "Welcome" + "  " + p_user.toUpperCase();
    }p_user - say this in vo also
p_pwd - say this in vo also
just an references.
Edited by: Erp on Nov 23, 2011 11:00 PM

Similar Messages

  • How to override the where clause (Bind Variables) in Backing Bean.

    HI
    I am using bind variables in VO and using exeutewithparam to pass the values to bind. Which is working fine.
    But what i want now to override the values pro grammatically from backing_bean of that page.
    How can i pass the values to bind variables from bean.
    M Niaz.

    Hi
    Try this if it works. this is from 10g
    1)create value binding in the backing bean on any action
    FacesContext ctx=FacesContext.getCurrentInstance();
    ValueBinding vb= ctx.getApplication().createValueBinding("#{bindings['account_name1'].inputValue}");
    2) and then set the value for binding
    vb.setValue(ctx,(String)accountInput.getValue());
    Now execute the method with method binding and execute it
    ctx.getApplication().createMethodBinding("#{bindings.ExecuteWithParams.execute}",null).invoke(ctx,null);
    Regards
    Rohit

  • Invoking binding operation from backing bean -- no data displayed in ADF table ?

    Hello experts, I have data control derived from  Web Service proxy client.  In this data control,  I have  multi record list derived from web service call.In my ADF page,  I have bunch of input components with many drop down lists and radio buttons, check boxes etc.
    Finally  I want to transfer user input to   data control.   In my  ADF page,  I  have mapped  the  result set of data conrol to  ADF table.
    When I click submit button,  the   input data from ADF page is passed to data control  operation.   In the bean method,  I am making use of   operationBinding.execute()  and operationBinding.getParamsMap().put().     I see it is fetching data by checking getResult().
    I am invoking partial trigger also on the table.  However, table is not getting populated with the data.
    please help me.     Jdeveloper verion is 11.1.1.6.     I have set "Refresh" attribute to "never"  for  iterator in the bindings tab.    But no luck.  I see that control coming to data control and calling web service and getting the data  and then it comes back to my bean method submit() and I see that getResult() is showing records fetched.   But  why  the table on ADF page is not showing the data ?
    thanks a lot in advance.

    I still not able to get  my table updated with  data.  If  I set   "Refresh"  to  "ifNeeded",  soon after coming out of  submit  method of bean, it again tries to execute the web service call in the  data control  and brings empty result since the search parameters are empty.  I do not know why it goes again to data control method.    So, when I hit submit button,  the bean method calls  operationBidnding.execute() and before this I set the parameters also.    After execute(),  addPartialTarget() gets executed and it comes out of submit.   At this time, it is supposed to go to ADF page.  But I see  that  it tries to execute  method in data control with empty parameters.   This is ridiculous.    It neither works with "never", nor with "ifNeeded". 
    I see many forums on this issue but no solution found...all those forums are not answered.  This looks like it is a bug in ADF table not able to refresh from  managed bean !!!!     
    thanks

  • Remove unwanted backing bean binding

    Hi All,
    My JSFX page has around 200 fields and I have to manipulate only a few fields in the backing bean. When I use this method to bind the UI components with the backing bean Design--> Page Properties ---> Component Binding ---> Auto Bind, all the page UI components get bound. This creates unnecssary binding and my backing bean java files becomes quite messy and runs into 5000 lines. Is it possible to remove the unwanted ones manually without causing any harm. What's the best practice by the way.
    Thanks
    Edited by: user5108636 on Mar 10, 2011 8:38 PM

    Hi,
    This creates unnecssary binding and my backing bean java files becomes quite messy and runs into 5000 lines
    This exactly is why the auto-generate option for backing beans is disabled by default in JDeveloper. There is no functionality in the IDE to remove unneeded bindings (how would the tool be able to tell what you need and what you don't need given that managed beans can be referenced from other managed beans and are referenced from EL in the component binding property).
    Best practices for working with backing beans is to not create them by default and instead use managed bean that you turn into backing beans (which is when they have a page component binding reference) only when needed. This way you stay in control
    Sorry, I have no better answer for this
    Frank

  • Faces: programmatically creating and populating iterator in a backing bean?

    Rather than relying on bindings in pageDefs, I'm attempting to create and populate a JUIterator binding in a backing bean. The goal is to allow the backing bean accessible to any web page as a session bean without having to hard code the iterator in every page's pageDef file.
    I haven't had any success on finding a demonstration showing how to do this programmatically and have come up with the following code as a hack:
    DCDataControl dataControl = bindingContainer.findDataControl("AppModuleDataControl");
    ApplicationModule appModule = dataControl.getApplicationModule();
    JUIteratorBinding iterator = new JUIteratorBinding(appModule, "SingleRowView1", "SingleRowView1Iterator");
    bindingContainer.addIteratorBinding(iterator);
    iterator.setRangeStart(0); // Exception raised here
    iterator.setRangeSize(1); // Or here
    iterator.executeQuery();  // Or here
    Row row = iterator.getCurrentRow();Note the SingleRowView1 is a VO exposed through my ADF BC AppModule and returns a single row and column.
    At the appropriate line marked "Exception raised here" an exception is thrown. On this line and the next 2 lines, it doesn't matter if I comment out one or the other, any 3 will raise an exception showing I've a problem with the iterator setup I guess?
    Anybody any hints on how we would construct the iterator dynamically? Do I have to create the individual attributes for the iterator? Have I not done something in correctly creating the iterator?
    Any help appreciated.
    Regards,
    CM.

    Chris,
    I don't have an answer for you but in JDeveloper 11 templating allows you to create a pagedef file that then is inherited by all pages. So chances are that what you build today is no longer needed tomorrow
    Frank

  • Differences between servlet and backing bean

    Could anyone please tell me whether everywhere that servlet can be used, backing bean and JSF can be used too? Are JSF and backing beans the new alternatives for JSP and servlets? please clarify the relations between these concepts for me.
    Thanks
    Laura

    Laura_Jlover wrote:
    Thank you. You mean backing beans can do every thing that servlets can do? Yes.
    JSF pages can work with servlets? Strictly speaking, every JSF page gets passed through the FacesServlet which does all the task. The lifecycle, creating the FacesContext, putting the request parameters in backing beans, rendering the response, etcetera.
    what are the advantages of servlet and the advantages of backing beans? what's the disadvantages? In general, which one is better?In context of JSF, you should be using backing beans, not Servlets. There is nothing what a Servlet can offer you as an advantage in the JSF context. It is simply not an option/alternative. You can't even call a Servlet (directly) using a JSF h:form. You, however, can access backing beans in any JSP or Servlet outside the JSF context.
    Just carefully read the JSF specification or buy a JSF book and the picture will be clear.
    JSF spec: [http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html].
    JSF book: [http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400].

  • Problem in obtaining collection of parameters onto my backing bean

    Hi All,
    I am working on a page 'browse.jsp' inside Alfresco CMS to implement a customization of mine wherin in the "details" view, inclusion of checkboxes besides the document names and their checking and submission will result in thier display in a subsequent JSP.
    Here is my code snippet from line no 411 of 'browse.jsp'
    BeanForSendMultiple.java is my backing bean.
    <%-- Primary column for details view mode --%>
    <a:column id="col10" primary="true" style="padding:2px;text-align:left" rendered="#{BrowseBean.browseViewMode == 'details'}">
    <f:facet name="header">
    <a:sortLink id="col10-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
    </f:facet>
    <h:dataTable binding="#{BeanForSendMultiple.dataTable}"
                                 value="#{BeanForSendMultiple.nameDetails}" var="loc">
                        <h:column>
                            <h:selectBooleanCheckbox value="#{loc.selected}"/>
                            <h:outputText value="#{loc.docContentName}"/>
                        </h:column>
                    </h:dataTable>
    <a:actionLink id="col10-act2" value="#{r.name}" href="#{r.url}" target="new" >
    <f:param name="documentDetails" value="#{r.name}" />
    </a:actionLink>
    <r:lockIcon id="col10-lock" value="#{r.nodeRef}" align="absmiddle" />
    <h:outputLabel id="col10-lang" value="#{r.lang}" styleClass="langCode" rendered="#{r.lang != null}" />
    <r:nodeInfo id="col10-info" value="#{r.id}">
    <h:graphicImage id="col10-img" url="/images/icons/popup.gif" styleClass="popupImage" width="16" height="16" />
    </r:nodeInfo>
    </a:column>Here is my backing bean BeanForSendMultiple
    public class BeanForSendMultiple {
        private List<NamesDetails> nameDetails;
        private String []documentDetails;
        private HtmlDataTable dataTable;
        private NamesDetails nameFurtherDetails = new NamesDetails();
        public BeanForSendMultiple(){
            nameDetails = new ArrayList<NamesDetails>();   
               NamesDetails nameFurtherDetails1 = new NamesDetails(); 
               for(int k=0;k<=documentDetails.length;k++){
                   nameFurtherDetails1.setDocContentName(documentDetails[k]);                  
               nameDetails.add(nameFurtherDetails1);
        public HtmlDataTable getDataTable() {
            return dataTable;
        public void setDataTable(HtmlDataTable dataTable) {
            this.dataTable = dataTable;
         public List<NamesDetails> getNameDetails() {
            return nameDetails;
           public void setNameDetails(List<NamesDetails> nameDetails) {
            this.nameDetails = nameDetails;
           public String submit(){
            Iterator iterator = nameDetails.iterator();
            while (iterator.hasNext())
                nameFurtherDetails = (NamesDetails)iterator.next();
                System.out.print(nameFurtherDetails.isSelected());
                System.out.print(nameFurtherDetails.getDocContentName());
            return "dataTableCheckBox";
         public String[] getDocumentDetails() {
           return documentDetails;
           public void setDocumentDetails(String documentDetails[]) {
            this.documentDetails = documentDetails;
    }and here are the getters and setters for the document
    public class NamesDetails implements Serializable
        private static final long serialVersionUID = 7526471155622776147L;
        private boolean selected;
        private String docContentName;
        public boolean isSelected() {
            return selected;
         public void setSelected(boolean selected) {
            this.selected = selected;
         public String getDocContentName() {
           return docContentName;
           public void setDocContentName(String docContentName) {
            this.docContentName = docContentName;
    }But on running the application i am getting the following stack trace: The issue being a NullPointer exception in obtaining documentDetails.length from the BeanForSendMultiple
    javax.faces.FacesException: An exception occurred processing JSP page /jsp/browse/browse.jsp at line 430
    427: <a:sortLink id="col10-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
    428: </f:facet>
    429:
    430: <h:dataTable binding="#{BeanForSendMultiple.dataTable}"
    431: value="#{BeanForSendMultiple.nameDetails}" var="loc">
    432: <h:column>
    433: <h:selectBooleanCheckbox value="#{loc.selected}"/>
    Stacktrace:
    caused by:
    org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp/browse/browse.jsp at line 430
    427: <a:sortLink id="col10-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
    428: </f:facet>
    429:
    430: <h:dataTable binding="#{BeanForSendMultiple.dataTable}"
    431: value="#{BeanForSendMultiple.nameDetails}" var="loc">
    432: <h:column>
    433: <h:selectBooleanCheckbox value="#{loc.selected}"/>
    Stacktrace:
    caused by:
    javax.faces.el.EvaluationException: Cannot get value for expression '#{BeanForSendMultiple.dataTable}'
    caused by:
    java.lang.NullPointerException
    Hide Details
    javax.faces.FacesException: An exception occurred processing JSP page /jsp/browse/browse.jsp at line 430
    427: <a:sortLink id="col10-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
    428: </f:facet>
    429:
    430: <h:dataTable binding="#{BeanForSendMultiple.dataTable}"
    431: value="#{BeanForSendMultiple.nameDetails}" var="loc">
    432: <h:column>
    433: <h:selectBooleanCheckbox value="#{loc.selected}"/>
    Caused by: java.lang.NullPointerException
    at org.alfresco.web.bean.BeanForSendMultiple.<init>(BeanForSendMultiple.java:108)
    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:513)
    .....Could any one please guide me on my approach where i am missing out.
    Thank You

    You can use:
      public Object resolveExpression(String expression)
        FacesContext ctx = getFacesContext();
        Application app = ctx.getApplication();
        ValueBinding bind = app.createValueBinding(expression);
        return bind.getValue(ctx);
      }and
    BindingContainer bc = (BindingContainer) resolveExpression("#{bindings}");John

  • Binding an object tag value / Creating HTML via a backing bean

    I have a task flow that sets some properties in my backbean. I've bound the "classid" of an <object> tag to one of these values. However, the first time i load the JSFF page, the object tag isnt created, but if i refresh the page, its loaded correctly.
    This would lead me to believe that the binding isn't being done before the JSFF is rendered, so the question is. Does anyone know how to fix this? and if not, i have thought about creating a backing bean that would add the <object> tag to the page with the bind value, but have no idea how i would go about this.
    Does anyone know of any good tutorials on adding HTML via a backing bean before the page is rendered?

    After further investigation and talking to a colleague, It seems it might not be binding related, since if I print out the bind in a text field, it displays correctly. I think the problem is because I am trying to inject an object tag (hosts a .NET control) into a fragment, but this is never picked up and rendered. Thus, when I do a full page refresh, the object tag is added and all goes well.
    If I attempt to bind/add a ADF Faces component this way, it works correctly.
    Do you know how to inject code for a fragment?, I am very stuck at the moment - don't have that much knowledge on ADF, so any links/help would be appreciated.
    My scenario is this:
    I am using a task flow that has 2 fragments.
    Fragment 1: set properties - has two input fields and a next button which are bound to a bean that saves the input fields
    Fragment 2: display object tag using step ones properties.

  • Feedback requested: in backing bean, use AM svc method or operation binding

    Hello all,
    I'm posting this here to solicit feedback from both Oracle and from the community at large. The basic question is around what is the best/better practice for calling Application Module service methods from a backing bean. One choice is to call the service method directly on the application module; the other is to put an operation binding in the page definition and to execute that binding. The basic code for the two methods:
    ((MyAppModule) getBindings().getDataControl.getApplicationModule()).serviceMethod();or
    getBindings().getOperationBinding("serviceMethod").execute();My question comes up specifically because of differences in how the default error handling works. For testing, we created a simple AM with a single service method that throws a JboException (a kind of RuntimeException). Then, we created a simple ADF Faces page with an af:messages (to see how error handling works) and four af:commandButtons. The four command buttons are as follows (the code is in the backing bean for each of them):
    1). partialSubmit=false, calls application module service method directly
    2). partialSubmit=false, executes service method via operationBinding
    3). partialSubmit=true, calls application module service method directly
    4). partialSubmit=true, executes service method via operationBinding
    None of the backing bean methods catch any exceptions. Note that #2 and #4 could be bound directly to the methodBinding in the pagedef, but we did it via code in the backing bean to more accurately mimic some of the code in our application; in any case, the results were the same using either method for #2 and #4.
    The results when clicking each button:
    1). ugly stack trace in the browser window (yuck!)
    2). the af:messages component displays the JboException (nice)
    3). No stack trace, no error message (even worse than #1, user thinks "success," even though exception occurred)
    4). the af:messages component displays the JboException (nice)
    This leads me to think that perhaps calling via the binding container is the preferred method because the default error handling gives acceptable behaviour, whereas using the AM directly gives unacceptable behaviour.
    Another "benefit" of calling through the binding container is that the technology in the model layer could be changed without having to change the view layer. I say "benefit" in quotes because I personally believe that one should write applications to take full advantage of the technology they choose, not try to strive for technology/database independence (no flames on this one please - that's not the main point here ;).
    Having made the preliminary conclusion that the binding container is the preferred way to go for service methods - that could then ostensibly be extended to view objects as well. Should the view layer use iteratorBindings instead of dealing with view objects directly as well? This is a bit more shaky ground because there are some points in the view/controller layer (namely managed beans not associated with any page) where there is no binding container available. However, in backing beans, for re-executing queries we could make the "best practices" statement to always use iteratorBindings instead of accessing the AM/VO. I just completed a test comparing view object usage vs iterator binding usage (vo.executeQuery() vs myIter.executeQuery()) with similar results to the AM testing - the binding container route gives acceptable error handling, whereas the VO route forces me to implement my own error/exception trapping and message display.
    I am aware of one drawback to using the binding container instead of the AM directly - that is that each page that needs the service method must have something in it's pageDef for that method. Originally, we had some code in a superclass of some backing beans that called the AM directly, and we didn't need to touch the pageDefs of approximately 20 JSF pages - when changing to use the operation binding - we had to add it to a lot of page defs.
    I'm very interested in feedback from the community at large on my conclusions. If the discussion gets to be too big/complicated for here, we can change venues to perhaps the oracle wiki or another forum. I did do a quick review of SRDemo ADFBC and noted that all of the service method calls are done through operation bindings - I never noticed that before! Most of the discussion we see in the forums shows people calling them directly, which is why I thought it important to post here.
    Best regards,
    John

    What we did in our project was that we create a "Headless" pagedefinition, (that was how it was described in SRDemo documentation or in JDeveloper help, its on the latter part about Security).
    You have to create that pagedef manually. and it only has an
    <page id="yourPageDef_Id" path="..."> entry in your Databindings and no
    <page path=".../yourPageDef_id" usageId=".../???.jsp">And then in your faces_config and your managed bean name is backingSystemStateBean and is located at path.to.bean.SystemState add a Session scope bean entry like this:
      <managed-bean>
        <managed-bean-name>backingSystemStateBean</managed-bean-name>
        <managed-bean-class>path.to.bean.SystemState</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
          <property-name>bindings</property-name>
          <value>#{data.yourPageDef_Id}</value>
        </managed-property>

  • Dynamically binding backing bean

    Dynamic binding of backing bean
    Here is a problem that I have been trying to solve. Maybe someone can have a go at it:
    Here is a Search form(Simplified version):
    af:selectOneChoice - to choice a 'class family' e.g., companies, NGO, charity, institution etc
    af:inputText - to enter a name
    af:commandButton – to search
    Here is a User task:
    1.     Choose a 'class family' from the selectOneChoice
    2.     Enter a name in inputText
    3.     Click commandButton to start the search
    Additional information
    1. The number of 'class family' is about 30 and requires different method of search.
    2. I want to use a uniform search user interface and so there is only one page for all.
    3. Each 'class family' has it own managed bean in face-config.xml.
    Scenario:
    Lets say the searchUI.jsp has an initial backing bean called SearchBean.java. The af:selectOneChoice in searchUI.jsp has a valueChangeListener and when the user chooses a 'class family' at step (1), the valueChangeListener in SearchBean.java is triggered.
    Problem:
    The problem is how do I dynamically switch the backing beans, say from SearchBean.java to SearchCompanyBean.java so that when the user next click the search commandButton, it is the searchAction method in the SearchCompanyBean.java and NOT the initial SearchBean.java that handles the action.
    Cheers in advance.

    Hi,
    Assuming you are using ADF BC, have a look at using view criteria. You can define, dynamically apply and remove view criteria on the view object.
    Have a look at the help on oracle.jbo.ViewCriteria and applyViewCriteria from the ViewObject implementation class. Sounds like they might meet your requirements.
    Create a client method on your VO and drag it onto your page as an ADF parameter form and go from there.
    Brenden

  • How add auto binding backing bean to a jspx page

    A few times during development, I didn't check "automatically expose UI components to in a manage bean" when the jspx page was first created.
    Can someone tell if there is a way to add auto binding backing bean to the page later?
    Thanks

    Hi Deborah,
    when your JSPX page is active, select menu Design -> Page Properties...
    Click Tab Component Binding
    Select Auto Bind and select (or create with New) your Managed Bean
    Regards,
    Didier.

  • How to bind ADF table with a collection of elements using backing bean.

    Hi Experts,
    My JDev version is 11.1.1.6.0.
    I need to bind ADF table with a collection of elements using backing bean.
    My backing bean consists of 6 lists of strings, where each list represents a column of table. How can I populate the entries of table with these lists.
    Thanks
    Gopi

    Hi,
    Create an object representing the row (setter/getter). Then have a list of these objects. Drag and drop the table and point its value to the list and the type to the row object
    Frank

  • Issue with passing parameters from JSP to Backing bean

    hi ,
    I have an issue in passing parameters from my JSP to backing bean. I want to fetch the parameter from my URL in backing bean .This is how i am coding it right now. But the parameter companyID returns me null.
    URL http://localhost:8080/admin/compadmin.jsp?companyID=B1234.
    In my backing bean
    FacesContext context = FacesContext.getCurrentInstance();
    String companyID = (String)context.getExternalContext().getRequestParameterMap().get("CompanyID");
         public void setCompanyID(String companyID)
              this.companyID=companyID;
         public String getCompanyID()
              return this.companyID;
    faces-config.xml :
       <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.admin.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>companyadminbean</property-name>
                   <property-class>com.admin.model.AdminBean</property-class>
                   <value>#{companyadminbean}</value>
                         </managed-property>
                        <managed-property>
                                 <property-name>companyID</property-name>
                              <value>#{param.companyID}</value>
                             </managed-property>Please let me know if iam missing something.Appreciate your help in advance
    Thanks

    Thanks very much for your input. I made changes to my bean accordingly. Actually the method getAdminType() is a not a getter of a property. It's just a method which iam calling in AdminController bean constructor to verify whether the person is System Admin or Client admin. So now the issue is inspite of making changes still the link "Copy Users" shows up for Client admin too which is incorrect.
    My Administrator bean:
    public class Administrator {
      boolean GSA=false;
      boolean SA=false;
      public Administrator(){}
    public boolean isGSA()
        return GSA;
      public boolean isSA()
        return SA;
      public void setGSA(boolean value)
        this.GSA=value;
      public void setSA(boolean value)
        this.SA=value;
    }My backing bean:
    public class AdminController {
    private AdminBean adminbean = new AdminBean();
    public AdminController(){
    int userID=1234;
    this.getAdminType(userID);           
    public void getAdminType(int userID)
             Administrator admin = new Administrator();
             if (userID<0) return;
             try{
                 if(Rc.isGlobalSystemAdmin(userID)){
                      admin.setGSA(true);
                              }else if(Rc.isClientSystemAdmin(userID)){
                      admin.setSA(true); // i could see these values setup correctly in the admin bean when i print them
                 adminbean.setAdmin(admin);
                  } catch (Exception e){ }
    Admin Bean:
    public class AdminBean {
    private Administrator admin; 
    public Administrator getAdmin()
                        return this.admin;
              public void setAdmin(Administrator admin)
                        this.admin = admin;
    faces-config.xml
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>adminbean</property-name>
                   <property-class>com.model.AdminBean</property-class>
                   <value>#{adminbean}</value>
             </managed-property>
         </managed-bean>
         <managed-bean>
              <managed-bean-name>adminbean</managed-bean-name>
              <managed-bean-class>com.model.AdminBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <managed-property>
                   <property-name>admin</property-name>
                   <property-class>com.model.Administrator</property-class>
                   <value>#{admin}</value>
                             </managed-property>
         </managed-bean>     My JSP:<h:outputLink id="ol1" value="/companyadmin/copyusers.jsp">
               <h:outputText id="ot1" value="Copy Users" rendered="#{adminbean.admin.isGSA}" /><f:verbatim><br/></f:verbatim>
               </h:outputLink>    so now the issue is thelink copy users is displayed even #{adminbean.admin.isGSA} is FALSE. please advise.
    Thanks
    Edited by: twisai on Oct 15, 2009 7:06 AM

  • Have a backing bean in request scope; need to access parameters sent to it

    I have a request scope backing bean in my app, 'projectBean'. This has a property called 'id'.
    /** in request scope in faces-config.xml */
    projectBean {
        id               // set by the param from the previous page
        downloadAction() // activated by commandlink, depends on id
    }There is another backing bean in session scope called 'projectListingBean', which has a dataTable that lists a bunch of projectBeans. In this 'projectListingBean', I can click on any row. That row, when clicked initializes a 'id' parameter, which is then passed to the new 'projectBean'. 'projectBean' then initializes itself based on the id.
    In the jsp page backed by 'projectBean', I also have a link to download something specific to that 'projectBean'. Naturally enough, I have a commandlink with actionBinding to a method in my 'projectBean', downloadXXXAction().
    The problem arises because the downloadXXX() method relies on a 'id'. Remember, this id was orinigally set 2 requests back from the datatable. Since the page backed by 'projectBean' is in request scope, the id is lost, and my method call doesn't work. I tried changing the scope of 'projectBean' to session, but JSF complains that I already setting the 'id' property as a param, I can't set the whole managed bean to something 'higher' like session.
    Of course, the ideal fix to this probelm would be the ability to have beans in page scope, but what other ways (hacks??) are there to get around this?

    Hi, I'm posting some code snippets if it helps with understanding the problem.
    faces-config.xml:
    <!-- PROJECTLISTINGBEAN -->
    <managed-bean>
         <managed-bean-name>projectListingBean</managed-bean-name>
         <managed-bean-scope>session</managed-bean-scope>
         <managed-property>
              <property-name>projectBeans</property-name>
              <property-class>java.util.List</property-class>
              <list-entries>
                   <value-class>
                        com.sun.sleuth.omcmweb.view.bean.ProjectBean
                   </value-class>
              </list-entries>
         </managed-property>
    </managed-bean>
    <!-- PROJECTBEAN -->
    <managed-bean>
         <managed-bean-name>projectBean</managed-bean-name>
         <managed-bean-class>
         </managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
         <managed-property>
              <property-name>projectId</property-name>
              <property-class>java.lang.String</property-class>
              <value>#{param.projectId}</value>
         </managed-property>
    </managed-bean>projectlsting.jsp (page backed by projectListingBean)
    <h:dataTable value="#{projectListingBean.projectBeans}"
         var="projectBean" ...>
         <h:column>
              <f:facet name="header">
              </f:facet>
              <h:commandLink action="#{projectListingBean.viewProjectSUmmary}">
                   <h:outputText value="#{projectBean.projectId}" />
                   <f:param name="projectId" value="#{projectBean.projectId}" />
              </h:commandLink>
         </h:column>
    </h:dataTable>projectsummary.jsp (page backed by request scoped projectBean)
    <h:commandLink action="#{projectBean.assessmentAction}" value="..." />
    ...Flow:
    projectlisting.jsp (projectListingBean - session) -param id passed->
    projectsummary.jsp (projectBean - request) -commandLink clicked and id lost-->
    projectSummary.jsp (projectBean - request)

  • How to set List and Tree Binding Value manually from backing bean?

    Dear All,
    I somehow found this code to work so that I could set a value on my bindings from a managed bean.
      public void setBindingExpressionValue(String expression, Object value)
        FacesContext facesContext = getFacesContext();
        Application app = facesContext.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesContext.getELContext();
        ValueExpression valueExp =
          elFactory.createValueExpression(elContext, expression, Object.class);
        valueExp.setValue(elContext, value);
      public class MyBean{
      private String employeeId;
      public void inAmethod(){
           setBindingExpressionValue("#{bindings.employeeId.inputValue}",
                                         getEmployeeId());
      }Now, I am thinking. What if I have a List or Tree Binding in my managed bean then how or what should I send
    to the expression value. Is it a List or Map?
    The first one was easy as it is just a string but how about when dealing with collection?
    JDEV 11g PS4
    Thanks

    Hi,
    a tree binding does not set the value of the tree but determines the selected node. The binding itself represents the collection model that shows the hierarchical tree structure. So your question does not apply to a tree
    Frank

Maybe you are looking for