To get value of a ADFdropdown in backing bean without submit button

hi all,
It maybe a very easy thing to do ,but please could you help me with this as I am new to ADF?I have a dropdown whose value i need in my backing bean without the use of a submit button..
please do help me out!!!!

Hi Frank ,
Thank You for replying...
But even after autosubmit=true, it didnt work..
i shall post the code below,could u please throw more light on it?
<af:selectOneChoice value="#{bindings.fetchbusinessservicesVO1Pagename.inputValue}"
label="#{bindings.fetchbusinessservicesVO1Pagename.label}"
binding="#{GiveAccess.selectOneChoice1}"
id="selectOneChoice1" >
<f:selectItems value="#{bindings.fetchbusinessservicesVO1Pagename.items}"
binding="#{GiveAccess.selectItems1}"
id="selectItems1"/>
</af:selectOneChoice>
<af:commandButton text="commandButton 1"
binding="#{GiveAccess.commandButton1}"
id="commandButton1"
action="#{GiveAccess.getItemsList}"/>
When i use Command button it works fine..but i want the same functionality without the command button.(GiveAccess is the backing bean where i want the value from dropdown)

Similar Messages

  • How to get the current JSF phase in backing bean?

    How to get the current JSF phase in backing bean?
    Edited by: jimmy6 on Nov 27, 2007 7:27 AM

    I am using phasetracker to trace it also.I want to know whether it is it render response phase. I know FacesContext.getCurrentInstance().getRenderResponse() work for normal jsf component but it will not work for qiupukit datatable. FacesContext.getCurrentInstance().getRenderResponse() will not return true in the following phase. Why?
    [ INFO] 27-11-07 16:20:21 : BEFORE RENDER_RESPONSE(6) (http-80-Processor23)
    I want the 'get' method of datatable being called in response phase to reduce the number of calling because i put the query in 'get' method there. Actually i still straggling with the best practice to code the datatable...

  • How to get an XML string from a Java Bean without wrting to a file first ?

    I know we can save a Java Bean to an XML file with XMLEncoder and then read it back with XMLDecoder.
    But how can I get an XML string of a Java Bean without writing to a file first ?
    For instance :
    My_Class A_Class = new My_Class("a",1,2,"Z", ...);
    String XML_String_Of_The_Class = an XML representation of A_Class ?
    Of course I can save it to a file with XMLEncoder, and read it in using XMLDecoder, then delete the file, I wonder if it is possible to skip all that and get the XML string directly ?
    Frank

    I think so too, but I am trying to send the object to a servlet as shown below, since I don't know how to send an object to a servlet, I can only turn it into a string and reconstruct it back to an object on the server side after receiving it :
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class Servlet_Message        // Send a message to an HTTP servlet. The protocol is a GET or POST request with a URLEncoded string holding the arguments sent as name=value pairs.
      public static int GET=0;
      public static int POST=1;
      private URL servlet;
      // the URL of the servlet to send messages to
      public Servlet_Message(URL servlet) { this.servlet=servlet; }
      public String sendMessage(Properties args) throws IOException { return sendMessage(args,POST); }
      // Send the request. Return the input stream with the response if the request succeeds.
      // @param args the arguments to send to the servlet
      // @param method GET or POST
      // @exception IOException if error sending request
      // @return the response from the servlet to this message
      public String sendMessage(Properties args,int method) throws IOException
        String Input_Line;
        StringBuffer Result_Buf=new StringBuffer();
        // Set this up any way you want -- POST can be used for all calls, but request headers
        // cannot be set in JDK 1.0.2 so the query string still must be used to pass arguments.
        if (method==GET)
          URL url=new URL(servlet.toExternalForm()+"?"+toEncodedString(args));
          BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
        else     
          URLConnection conn=servlet.openConnection();
          conn.setDoInput(true);
          conn.setDoOutput(true);           
          conn.setUseCaches(false);
          // Work around a Netscape bug
          conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
          // POST the request data (html form encoded)
          DataOutputStream out=new DataOutputStream(conn.getOutputStream());
          if (args!=null && args.size()>0)
            out.writeBytes(toEncodedString(args));
    //        System.out.println("ServletMessage args: "+args);
    //        System.out.println("ServletMessage toEncString args: "+toEncodedString(args));     
          BufferedReader in=new BufferedReader(new InputStreamReader(conn.getInputStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
          out.flush();
          out.close(); // ESSENTIAL for this to work!          
        return Result_Buf.toString();               // Read the POST response data   
      // Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands.
      // @return the URLEncoded string with name=value pairs
      public String toEncodedString(Properties args)
        StringBuffer sb=new StringBuffer();
        if (args!=null)
          String sep="";
          Enumeration names=args.propertyNames();
          while (names.hasMoreElements())
            String name=(String)names.nextElement();
            try { sb.append(sep+URLEncoder.encode(name,"UTF-8")+"="+URLEncoder.encode(args.getProperty(name),"UTF-8")); }
    //        try { sb.append(sep+URLEncoder.encode(name,"UTF-16")+"="+URLEncoder.encode(args.getProperty(name),"UTF-16")); }
            catch (UnsupportedEncodingException e) { System.out.println(e); }
            sep="&";
        return sb.toString();
    }As shown above the servlet need to encode a string.
    Now my question becomes :
    <1> Is it possible to send an object to a servlet, if so how ? And at the receiving end how to get it back to an object ?
    <2> If it can't be done, how can I be sure to encode the string in the right format to send it over to the servlet ?
    Frank

  • How to call a Javascript function from backing bean without any event

    Hi,
    Someone knows how to call a Javascript function from backing bean without any event ?
    thanks

    Please review the following thread:
    ADF Faces call javascript
    Luis.

  • How to get selected items from a tree in backing bean without adfbc

    Hi ADF Experts,
    Below is my code for af:tree. My question is how can I get selected Items from the selectionListener (without adf bc) this uses formation of tree from backing bean.
    Using Jdev 11.1.1.7.0
    <af:tree var="node" value="#{pageFlowScope.MerchandizeBean.model}"
                      binding="#{pageFlowScope.MerchandizeBean.treeModel}"     id="tree" immediate="true" autoHeightRows="0"
                           styleClass="AFStretchWidth" rowSelection="multiple"
                           selectionListener="#{pageFlowScope.MerchandizeBean.treeNodeSelection}">
                    <f:facet name="nodeStamp">
                      <af:commandLink text="#{node.classDescription}"
                           actionListener="#{pageFlowScope.MerchandizeBean.createListManyItemForMerchandise}"           id="displayTable" partialSubmit="true">
                      </af:commandLink>
                    </f:facet>
                  </af:tree>
        public void treeNodeSelection(SelectionEvent selectionEvent) {
            // Add event code here...
            RichTree tree = (RichTree)selectionEvent.getSource();
                    TreeModel model = (TreeModel)tree.getValue();
                    //get selected value
    Thanks
    Roy

    Hi,
    in a multi select case, try
    RowKeySet rks = tree.getSelectedRowKeys();
    Iterator iter = rks.iterator();
    while(iterator.hasNext()){
    Object aKey = iterator.next();
    tree. setRowKey(aKey);
    Object rowData ? tree.getRowData();
      .... do something with the data here ...
    Frank

  • Display values on new window from backing bean HashMap

    Hi,
    I need to open a new window when user clicks on some link from the current page. New window will display few values which are set once the link is clicked.
    I have created a bounded task flow with a jspx page added into the task flow. This jspx page contains a jsff page. While clicking on the link, I have called backing bean method which will create and set a HashMap containing key-value set which is used to display on new window.
    New window is created by javascript. And I am not able to get HashMap values which are set by bakingbean method.
    Is there anyway to solve this?
    Code:-
    Backing Bean method to open new window
    private void launchWindow () {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    // Taskflow parameters map
    Map <String, Object> params = new HashMap <String, Object> ();
    // Get taskflow URL to be opened in new window.
    String taskflowURL = ControllerContext.getInstance ().getTaskFlowURL (false, new TaskFlowId (
    AppsConstants.DESCRIPTION_TASKFLOW_DOCUMENT,
    AppsConstants.DESCRIPTION_TASKFLOW_ID), params);
    taskflowURL = taskflowURL.replaceAll("%2F", "/");
    ExtendedRenderKitService erks = Service.getRenderKitService (FacesContext.getCurrentInstance (), ExtendedRenderKitService.class);
    String jsScriptWindowOpne = "window.open(\"" + taskflowURL + "\", \"" + resourceBundleMapper.getString (AppsConstants.LBL_NOTI_DESC_NEW_WINDOW_TITLE) + "\");";
    try {
    erks.addScript (FacesContext.getCurrentInstance(), jsScriptWindowOpne);
    } catch (Exception e) {
    logger.log (Level.SEVERE, "Exception while adding javascript to open a new window in ExtendedRenderKitService object. " + e);
    New window jsff page
    <af:outputText value="#{backingBeanScope.notification.notificationDescriptionMap}" />
    Output
    I want to get values from this HashMap, to test the size/content of this Map, I have printed this Map.

    Hi,
    Yes its possible..
    A simple google search gave me this Result.
    Betw:
    you can also open taskflow as popup in your page(inline popup) instead of opening the taskflow in other browser window.
    53-taskflow-in-popup-169196.pdf
    Regards,
    Santosh.
    Edited by: Santosh Vaza on May 11, 2011 2:11 PM

  • Getting data from view object into backing bean

    Hi,
    My requirement is explained below -
         I have a ADF editable table in a jsf page which is connected to backend database table. In the table there are 6 columns and only 2 are editable. So when user inputs a value in first input column an event is triggered such that the data for all the remaining columns should be fetched from another database table.
    Typically if we are not using ADF development environment. We would have had a simple business method which creates the sql query by taking the input from textbox with simple where clause and I would have got the data. I am not getting any idea how to do this in ADF. I have the second table as view object but how to access the view object from backing bean and get data based on the input given.

    Hi,
    step 1) Expose a method on the ViewObject Impl class
    step 2) define arguments for the method as needed to identify the row to read data from
    step 3) retrieve the row from the VO that holds the data you want to add and return a HashMap with this information
    step 4) expose the method on the client interface (Java menu selection on the View Object)
    step 5) In the PageDef file, create a method binding to the method you exposed on the ViewObjectImpl
    step 6) Call the method binding from the managed bean like
    OperationBinding getDataFromVO = (OperationBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("Name of method binding);
    getDataFromVO.getParamsMap().put("name of arguments1", value1);
    getDataFromVO.getParamsMap().put("name of arguments2", value2);
    Object retData = getDataFromVO.execute();
    if(retData != null && getDataFromVO.getErrors().size()==0){
      HashMap retDataMap = (HashMap) retData;
    ... follow the rest of your logic ....
    Frank

  • H:selectManyCheckbox values to be passed to backing bean. Please help.

    Hello All,
    Please find the code below where I am facing some challenges.
    When the "QuestionBean.checkBoxEnabled" is true all options on my jsp page are displayed as checkboxes
    and when "QuestionBean.radioButtonEnabled" is true radio buttons are displayed.
    but on selection of my options and sumbiting them I am not being able to set these options in my backing bean.
    Till now I have learnt that when varbatim is used then setting of values is not done, because when I use my code
    with out verbatim I get my values in backing bean's setter and getter's.
    Please let me know if there is a work around in which I can select my options and subit the page and save them
    through backing bean and the verbatim condition also works.
    <f:verbatim rendered="#{QuestionBean.checkBoxEnabled}">
    <h:selectManyCheckbox id="optionselect2" value="#{QuestionBean.examAnswerList}">
    <f:selectItems id="a1" value="#{QuestionBean.alAnswerOptions}"></f:selectItems>
    </h:selectManyCheckbox>
    </f:verbatim>
    <f:verbatim rendered="#{QuestionBean.radioButtonEnabled}">
    <h:selectOneRadio id="optionselect" value="#{QuestionBean.examAnswer}">
    <f:selectItems id="a2" value="#{QuestionBean.alAnswerOptions}"></f:selectItems>
    </h:selectOneRadio>
    </f:verbatim>

    I don't know about f:verbatim (never used it or need it), but I tend to use Richfaces to do conditional additions, to be more precise the a4j:outputPanel component. With a layout="none" you can conditionally render JSF components without having any content being generated for the outputPanel itself.
    Another option I have used is to use the tag library of JBoss Seam: it has neat s:span and s:div tags that are very useful for conditional rendering also.
    I'm not saying that you should switch to these APIs, but at least you have some alternatives if you cannot fix your current solution.

  • Jsp:usebean How to get value of an object from a bean

    I am new to JSP and am struggling from past few days to solve a problem. Consider the below scenario
    Class Book{
    private String author;
    public void setAuthor(String author)
    public String getAuthor(){
    return author; }
    Class Rack{
    private Book []books;
    public []Book getbooks()
    return books;
    public void setbooks([]Book val){....}
    Suppose Books gets populated only using Rack and I have Rack populate in my session, using jsp:usebean or any other tag how can I get value of author? Does using tag handle null value check of books, if books are not set by any chance?
    Regards,
    Dhyan

    I got a way out to access the attribute, i feel it is
    <jsp:usebean id="myRack" class="settings.Rack"/>
    <c:foreach var="book" item="myRack.books">
    </c:foreach>
    I am not able to check if this is correct or not because myRack.books is not having any value set by me in the request scope. How do i get instance of Rack class set by another page in the current request? I can get the value if i use scriptlet but i dont want to use scriptlet.
    I am continiously trying, if I get an answer, I shall post, else pls somebody guide.

  • 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.

  • How to get the application module instance in backing bean.

    This is Ramesh, I am new to JDeveloper world.
    In my current application I have change password screen which allows user to change there password.
    Here this is a pop-up page. Here I don't have the view object and pagadef for this changepassword.jspx file.
    My aim is to call the Application Module method which takes the user name, old password and new password.
    In backing bean I am trying to call this method by using
    MyProjAM obj = _binding.getDataControl().getApplicationModule();  //throw null pointer exception.
    _binding is the object of DCBindingContainer. 
    ( I have created the parameter called "binding" as my managed bean property and values as #{binding})
    But the above line is throwing the NullPointerException.
    Could you please help me to come out of this problem.
    Thanks and Regards,
    Ramesh Biradar.

    If your page has no page definition, then #{bindings} will be null during the request for that page.
    If you need your page to invoke a data control method when you press a button, the simplest (and declarative) way is publish your AM method on the AM's client interface, then drop the method as a button from the data control palette onto your page. You don't even need a backing bean to accomplish this.
    That said, you can refer to a data control in a backing bean using the expression #{data.[i]YourAppModuleNameDataControl.dataProvider}
    So, assuming you have a helper method like this:
      public static Object EL(String expression) {
        FacesContext ctx = getFacesContext();
        Application app = ctx.getApplication();
        ValueBinding bind = app.createValueBinding(expression);
        return bind.getValue(ctx);
      }and assuming that your application module is named SRService
    and assuming that you have correctly nominated any Application Module custom methods as being available to clients by selecting them on the "Client Interface" panel of the application module editor, then in a backing bean you can acquire an instance.
    Then, the ADF design time will have automatically generated you a custom AM client interface named SRService and you can reference that service interface in your backing bean by using code like this:
            SRService svc = (SRService)EL("#{data.SRService.dataProvider}");
            svc.yourCustomMethod(your,args);

  • How can I get Connection(Database Connection)on my backing bean

    hello guys!
    How can I get the Database Connection on my managed bean?
    I want to use this connection for my reports.
    thanks a lot!
    alvin

    Alvin,
    You can access the data provider through ADF the binding. The data provider represents the business service you use. Once you have a handle to this you can get the connection.
    You don't mention the business service, so I cannot help you more than this. If it is ADF BC, have a look at http://download.oracle.com/docs/html/B25947_01/toc.htm and the stored procedure section. Steve Muench explains a trick to access the "real" JDBC connect used by ADF BC
    Frank

  • JSF - Click twice to get actual content and data from back Bean

    Hello,
    maybe an easy thing ... i got a Menu wih commandLink. the BackBean sends back the "from-outcome". After I cklick on a commandLine, the page is called, but some vars are still from page befor. cklicking second time, then it works. The bad thing about this, is, I have Realm, and the LoginPage appears after I click twice. The User sees the protected<page wthout beeing logged in ...
    someone has an idea?
    thx.
    PS.:Bean ist Session-Scope, marked as Stateful.

    Hello,
    thx for the answet. I debugged.
    When I call with the command the next page, I call a Bean which gives back the outcome ti display the next page. the vars i'm reading, i read with another bean, called when i make the content. apparently, when i use this
    context = FacesContext.getCurrentInstance();
    resp = (HttpServletRequest) context.getExternalContext().getRequest();
    System.out.println("Get " + resp.getRequestURI());
    the display says : "/company-db/index.faces"
    the page i'm go to is "registry.faces"
    when I click a second time, then the display is:
    the display says "/company-db/registry.faces"

  • How to get value from a metric based on date, without effecting other colum

    Hi
    I have 2 metrics say Revenue and Total Revenue and Date Dim
    For a selected date in the prompt, Revenue should be shown for that date, where as Total Revenue should be shown for the past 15 days, based on the date in the prompt.
    How can I achieve this?
    Cheers
    Edited by: OBIAS on Feb 28, 2013 4:57 PM

    Set a presentation variable in the Date Dim prompt, P_DATE.
    Within the request, edit the formula for Revenue to be...
    FILTER("Revenue" USING ("Date" = @{P_DATE}))
    And set the formula for Total Revenue to be something like...
    FILTER("Total Revenue" USING ("Date" between TimestampAdd(SQL_TSI_DAY, -15, @{P_DATE}) and @{P_DATE}))
    JB

  • Communications between two Backing beans

    Hi all,
    Currently I am working in an application which contains two pages. For eg page1.jsp and and page2.jsp which contains separate backing beans and JSP pages.Here I have included page2.jsp with page1.jsp using jsp:include which will be shown in a rich:modalpanel.This rich model panel will be rendered only when a button is clicked, say choose button.
    page1.jsp
    <h:form>
    // page1 jsp codes written using JSF
    </h:form>
    <<rich:modalPanel id="lPanelId" autosized="true" top="20px" left="90px" moveable="true" styleClass="rich-modalpanel rich-mpnl_panel">
                    <jsp:include page="/page2.jsp"/> // Include page2.jsp using a modal panel
                           </rich:modalPanel> I have used two seperate forms for each page.Though I have used jsp:include the forms of two pages(page1 and page2) are submitted when clicked the link of page1. So If I change anything in page1 for example if I selected a check box and when I clicked the choose button in page 1 inorder to include page2.jsp in a modal panel. If the same check box takes place in Page2.jsp means it should also be selected but I cant able to communicate between the two backing beans.because the page1 and page2 constructors are called when the page 1 is loaded.So I cannot communicate between page1 and page2 after the choose button action.
    Please anyone out there give me some valuable inputs on this regardings.
    Thanks in Advance

    chrisjohn wrote:
    Hi everybody,
    I have used <jsp:include> tag in a jsf page to include another page(which comes in a modal panel).I would like to know how to pass values from the first backing bean to second backing bean without any button action or Html form.please give some valuable inputs on this regarding.
    Thanks in AdvanceJust access the backing bean the usual way. It is also available there in the included page.

Maybe you are looking for