Dynamically Refresh Dropdown in JSF

I wanna dynamically refresh dropdown values. Here is my requirement
The user creates new record by selecting "New" value from the dropdown. Then user enters values on form fields and clicks the Submit button. The result is record gets created in the database and also gets populated in the dropdown. Now i wanna show this record as selected value in the dropdown instead of New to faciltate update/delete operations.
Note: The reason i am doing this is subsequent save results in detached object hibernate exception. To resolve this exception if i create a new instance then i will loose the original object so i cant do update/delete on the original object. My backing bean is in session scope
Any pointers/suggestions will be highly appreciated
Regards
Bansi

What do you mean by preset it by property because the new value is allready set in the backedbean but its not reflected on the page as the drop down doesn't get refreshed.

Similar Messages

  • Dynamically refresh a list box in a web report

    Dear All,
    I am having a serious issue with one of my web reports. I am using Oracle 9i PL/SQL Cartridges for developing my web reports. The problem is :
    I have a drop down box for department and also a list box for locations.
    I want to dynamically refresh the locations list box whenever the user selects a department.
    I know I have to refresh the page somehow to get the list box requery from the database.
    Can anyone please send me a sample code or suggest how to do it. I am new to PL/SQL cartridges.
    Thank You

    hello,
    althought his is not a PL/SQL cartridge forum i'll give it a shot.
    the basic behind the solution would be that your procedure need input values that would be used to create this cascading effect. so you would have e.g. input values for region and country for a form that should provide selection fro region country and city.
    when the procedure is called for the first time without any parameters, it would generate a drop down list for the first (region) parameter. when the user selects a value javascript would kick in that would submit the form that basically calls itself, but this time passing the value for the region parameter.
    now the procedure would create two drop down lists (region and country) because it had a value passed for region. both drop down lists would have a javaScript event that would submit the form. the only difference would be that the region list would need to clear the value of the country value before submitting so changing the region would produce a new country list.
    i hope that was clear enough. as for the code example. that is simple javaScript and you can find tons of examples on the Web. just look for "JavaScript" and "OnChange".
    regards,
    philipp

  • Dynamic Refresh not working

    Hello Experts
    I have a text box and a select list. As soon as the user enters a value in the text box, the select list should refresh depending on the value that has been entered in the text box. I have a query behind the select list which selects from a table where value = text box value.
    To achieve this I created a dynamic refresh on the text box so that it freshes the select list as soon as the focus is lost, but everytime I run the page, a refresh icon appears next to select list but it seems to refresh forever and nothing gets populated in the select list. If I submit the page then the list is populated, but I don't want to submit the page but want to pick up the value from the text box and refresh the select list.
    Any help on this is appreciated.
    Thanks

    Hi,
    >
    I have a text box and a select list. As soon as the user enters a value in the text box, the select list should refresh depending on the value that has been entered in the text box. I have a query behind the select list which selects from a table where value = text box value.
    To achieve this I created a dynamic refresh on the text box so that it freshes the select list as soon as the focus is lost, but everytime I run the page, a refresh icon appears next to select list but it seems to refresh forever and nothing gets populated in the select list. If I submit the page then the list is populated, but I don't want to submit the page but want to pick up the value from the text box and refresh the select list.
    >
    You cannot use LoV based on SELECT as the SELECT will execute only when the page is loaded, which you have already noticed.
    What you need to do is construct the HTML fragment for the select list and push it into your HTML DOM as described in Denes Kubicek's demo.
    Cheers,

  • Dynamic Refresh Region with APEX 4.0

    Greetings!
    With APEX 4.2, when you want to refresh a region that depends on an page-item-value, there are different ways to submit that item with the dynamic action ("Page Item zu Submit"). But this is not imcorperated in APEX 4.0 yet. Is there a way to work around that? I have tought about an apex.submit({...}) call, but I am not sure, where to insert it, also that would be a.. well... submit, not ajex.
    Thanks for any help,
    so long,
    tobi

    Thanks for the hint, but its still not working. I have another item, that gets the value of the item passed to on key-up event. This works. But no refresh of the region.
    My setup looks like that now:
    Event: Key Release
    Selection Type: Item
    Item: ... an auto complete text field
    Condition: is not null
    True Actions:
    1) Action: Execute PL/SQL Code
     Fire on Page Load, Stop exec on error
     PL/SQP Code: null;
     Page Items to Submit: ... that same autocomplete field
    2) Action: Refresh
     Fires on Page Load
     Selection Type: Region
     Region: ... the report region with the where clause comparing the text field.
    The identical action I created for the Get Focus Event, because that happens, when the user clicks on the dropdown list to select an item, then the text field gets focused again. Thats when I want the report to update.
    Only when I hit the enter key (what I actually dont want to happen, and thats another issue) the page gets submitted. Then the report is displayed with the new selection. But I dont want the user to wait for the page reload process.

  • How to create dynamic DataTable with dynamic header/column in JSF?

    Hello everyone,
    I am having problem of programmatically create multiple DataTables which have different number of column? In my JSF page, I should implement a navigation table and a data table. The navigation table displays the links of all tables in the database so that the data table will load the data when the user click any link in navigation table. I have gone through [BalusC's post|http://balusc.blogspot.com/2006/06/using-datatables.html#PopulateDynamicDatatable] and I found that the section "populate dynamic datatable" does show me some hints. In his code,
    // Iterate over columns.
            for (int i = 0; i < dynamicList.get(0).size(); i++) {
                // Create <h:column>.
                HtmlColumn column = new HtmlColumn();
                dynamicDataTable.getChildren().add(column);
                // Create <h:outputText value="dynamicHeaders"> for <f:facet name="header"> of column.
    HtmlOutputText header = new HtmlOutputText();
    header.setValue(dynamicHeaders[i]);
    column.setHeader(header);
    // Create <h:outputText value="#{dynamicItem[" + i + "]}"> for the body of column.
    HtmlOutputText output = new HtmlOutputText();
    output.setValueExpression("value",
    createValueExpression("#{dynamicItem[" + i + "]}", String.class));
    column.getChildren().add(output);
    public HtmlPanelGroup getDynamicDataTableGroup() {
    // This will be called once in the first RESTORE VIEW phase.
    if (dynamicDataTableGroup == null) {
    loadDynamicList(); // Preload dynamic list.
    populateDynamicDataTable(); // Populate editable datatable.
    return dynamicDataTableGroup;
    I suppose the Getter method is only called once when the JSF page is loaded for the first time. By calling this Getter, columns are dynamically added to the table. However in my particular case, the dynamic list is not known until the user choose to view a table. That means I can not call loadDynamicList() in the Getter method. Subsequently, I can not execute the for loop in method "populateDynamicDataTable()".
    So, how can I implement a real dynamic datatable with dynamic columns, or in other words, a dynamic table that can load data from different data tables (different number of columns) in the database at run-time?
    Many thanks for any help in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    flyeminent wrote:
    However in my particular case, the dynamic list is not known until the user choose to view a table. Then move the call from the getter to the bean's action method.

  • Dynamically refresh to report regions

    I have a page with multiple regions. Two of the regions are report regions that I want to refresh dynamically. I am using 4.0. I created a dynamic action that fires based on an item's value changing. It contains two actions, a 'Refresh' action for each region. Only one region will refresh. If I put an 'Alert' action between the two 'Refresh' actions, then both regions will be refreshed. I have tried to do this multiple ways, such as using the $a_report() function from within my page level javascript. Results are the same. I can get one region to refresh, but not two. Any ideas or suggestions on why I can not refresh multiple regions?

    Thanks for your reply. I tried what you said and still no luck. I then created a new page with two simple regions, a select list, and a button to trigger the refresh. I wanted it be stripped of any other items or code and I used your javascript. It still only refreshes one region. I am requesting space on the Oracle site and will create my test there. Maybe there is a bug in the version we have installed. Our version is 4.0.0.00.46.

  • How to create fillable PDF with dynamic content dropdowns?

    I'm creating a March Madness bracket for people that don't really understand how they work.  What I'd like to do is have dropdowns for each of bracket lines (they would list the teams playing against each other for that game and they would select who they think would win).  I would then like the dropdown for the next game to auto-populate with only the two options for the next round. 
    For example, team A and team B play against each other and teams C and D play against each other.  There are two separate dropdowns, one with A and B as choices and the other with C and D as choices.  The user thinks A and C will win their games, so the next dropdown would only have the options of selecting A and C.  To illustrate:
    AA and B are listed in the dropdown, and the user selects A to win.
    BA or C are listed in the dropdown because the user has selected A and C to win their previous games.
    CC and D are listed in the dropdown, and the user selects C to win.
    D
    I can make the first round dropdowns just fine, but I'm not sure how to conditionally/dynamically populate the second round dropdowns based off of user selections.

    I don't understand your request but my english is not the best.
    But here you can see a script. You can copy this in the first dropdown in the exit-event.
    In this example you will give the first dropdwon the entries
    "123"
    "345"
    "678"
    The first case describes what happens when the user clicks "123" the second drowdown will get the entries "456" and "789".
    When the user clicks "456" the second drowdown will get the entries "123" and "789".
    I think you can adapt this script as you need.
    Hope I could help a little bit,
    Mandy
    switch (xfa.event.newText)
        case "123":
            DropdownListe2.clearItems();
            DropdownListe2.addItem("Please select a value");
            DropdownListe2.addItem("456");
            DropdownListe2.addItem("789");
            DropdownListe2.selectedIndex = 0;
            break;
        case "456":
            DropdownListe2.clearItems();
            DropdownListe2.addItem("Please select a value");
            DropdownListe2.addItem("123");
            DropdownListe2.addItem("789");
            DropdownListe2.selectedIndex = 0;
            break;
        case "789":
            DropdownListe2.clearItems();
            DropdownListe2.addItem("Please select a value");
            DropdownListe2.addItem("123");
            DropdownListe2.addItem("456");
            DropdownListe2.selectedIndex = 0;
            break;
        default:
            break;

  • How to dynamically refresh system properties when changed

    Hi All,
    Through weblogic startup class I'm loading the properties from a properties file
    into system properties, Now my requirement is to refresh those system properties
    when ever I make changes to the properties.
    Is there any way to achieve this functionality through MBeans.

    Hello Lucky,
    I believe you cannot refresh properties file dynamically using MBeans. What
    you can do is write an MBean which necessrily mirror your property file and
    register with MBeanServer. You can set values on the MBean dynamically but
    in order to persist your changes you need to write your own persistance
    mechanism.
    Cheers
    Ali
    "Lucky" <[email protected]> wrote in message
    news:3f84d68f$[email protected]..
    >
    Hi All,
    Through weblogic startup class I'm loading the properties from aproperties file
    into system properties, Now my requirement is to refresh those systemproperties
    when ever I make changes to the properties.
    Is there any way to achieve this functionality through MBeans.

  • Dynamically refresh Flash chart in 4.2

    In my Apex 4.2 app I have a chart region that I want to refresh whenever a radio button group has changed.
    My radio button group P2_RG_DEPTNO returns static values 10 and 20.
    I created a dynamic action on the group to refresh the chart region when the value has changed.
    The chart series uses the value or the radio group in the query:
    select null, ename, sal from emp
    where deptno = :P2_RG_DEPTNO
    order by sal descHowever, the chart never refreshes.
    How can I refresh just the chart and have the series query re-execute, using the new value of P2_RG_DEPTNO?
    Workspace: cmr
    Username: [email protected]
    Pwd: cmrtest
    App ID: 16120
    Page: 2
    Thanks,
    Christoph

    Hi I checked your application.
    You had DA defined on P2_RG_DEPTNO but in your chart series query you referenced P2_X2 item. This is why the chart was not being refreshed.
    Change that to P2_RG_DEPTNO and check.
    I changed your chart query.
    Please check now.
    Thanks.
    Mehabub

  • Dynamic User Authentication in JSF, ADF BC Application

    I have developed a JSF, ADF BC Application using JDeveloper 10.1.3.3. My application consists of jspx pages and I also have to integrate some existing oracle forms with it using OraFormsFaces library.
    I have successfully used custom DBProcLogin Module by Frank to authenticate the users with the help of a stored procedure and user credentials stored in database tables.
    During integrating Oracle Forms I realised that some of these oracle forms use get_application_property(username) to retreive connected user information. All of the users which are stored in database tables are also oracle users with the same credentials as stored in database tables. The existing oracle forms based application was connecting to Oracle every time with different provided user credentials each time and therefore returning correct (required) user name information.
    Now since I have used DBProcLogin Module in new ADF application, when I run it, user is successfully authenticated but get_application_property(username) in the existing oracle forms returns the user name that application module is using to connect with the database. To make it work correctly, I want my ADF application to connect to oracle database with different user each time.
    I have searched and seen topics such as, Dynamic JDBC Credentials, Database Proxy Users etc. But I am confused with the width and depth of this much information available. Therefore, I thought I may get some advice from the experts present in the forum that which of the techniques will go best with my application.
    Keeping in view the scenario that I have provided, can someone please guide me to the best suitable technique and the related information/documentation?
    Thanks in advance,
    Amir

    Hi,
    the whitepaper you reference is written by the expert on this subject. Samples are posted by the same author: http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
    Note that what you try to do will create a dedicated connection for Forms and ADF, which means that 100 users will have 200 database connections open.
    Frank

  • LOV dynamic refresh in CR2008 with BOXI3.1

    Hi,
    I'm in a confusion whether the LOV for the prompts refresh dynamically when the crystal report is opened.
    It is a universe based report. I heard, in XIR2 it is a problem and it wont behave similar to WebI.
    When i tried in CR 2008 with BOXI3.1 unvierse, it DID refreshed dynamically and the LOV was changing for every user as row level security was applied. But at times, it doesnt refresh, which puzzles me.
    Will the LOV refresh dynamically in CR2008 with BOXI3.1or it will not?
    Please confirm.Many thanks.

    Yes it refreshes the LOV from Universe. For more details please go through the following document
    [http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/20984c2b-17f1-2b10-1091-d18977f7cd8f&overridelayout=true]
    in CRXIR2 if it is not refreshing the LOV from universe we have to follow these steps
    Registry Entry Information
    Subkey: HKEY_LOCAL_MACHINESOFTWAREBusiness ObjectsSuite 11.0Crystal ReportsDatabaseAlwaysRefreshUniverseLOV
    Type: STRING
    Recognized Values: Yes, 1
    Default Value:
    Creation Method: Hot Fix Installation
    Subkey: HKEY_LOCAL_MACHINEsoftware usiness objectssuite 11.5crystal reportsdatabaseAlwaysRefreshUniverseLOV
    Type: STRING
    Recognized Values: Yes,1
    Default Value: 0
    Creation Method: Hot Fix Installation
    Known limitations:
    When this registry key is in use, it may take longer to open a universe report in Crystal Reports designer or to view a report on-demand in a Business Objects Enterprise web application. Performance is affected because the Business Objects Enterprise Web Intelligence Report Server is called when a report that is based on a universe is opened, which adds more work to the server.
    In XIR2, the "Always Refresh List of Values" check box must be selected within the report. This option is on the Query Panel of Crystal Reports, within the properties of the object in the Query Filters section for each object that uses a list. By default, the "Always Refresh List of Values" option is enabled.
    In a universe, the object being used must have the "Automatic refresh before use" property enabled. For more information, see the "Using lists of values" section in chapter five of the Designer Guide.
    HTH
    Raghavendra.G
    Edited by: Raghavendra Gadhamsetty on Nov 18, 2009 6:48 PM

  • Dynamic refreshes

    In my application, there are cases where I need to update a form when the user changes some input value on the form. For instance, say the user selects a car as a vehicle type, I might want to update the form to add some input fields that are specific to cars. The way I am doing this right now is by making the vehicle type an immediate selectOneMenu component and performing a submit() in the onchange property. Invoking submit ensures that the value of the vehicle type gets change on the back-end and when the form gets refreshed, the new input controls get rendered. Not very efficient, but this works for me. However,there is a navigation issue with this way of handling the population of the form. If after changing the vehicle type, I move away to another page and click on the browser back button, the browser will not take me back to the page where I can specify the vehicle type. I will have to execute the back action as many times as I changed the vehicle type to eventually get back to that page. There must be something with the saving of the state. It's like the refreshing of the form isn't fully taken into account for handling of forward and back.
    Probably I could use AJAX to solve this kind of problem, but I would like to know if there is something else I can use or if anyone has best practice for this kind of problem.
    Martin

    I am wondering how a reset button would help in this situation. Would it get invoked automatically in one of the life cycle phases? My problem is that when my application is on page A and the user changes value of a selectOneMenu, page A is submitted and refreshed. Then if user navigates to page B and uses the browser back button, the application stays on page B. Would a reset button really help here? How so?
    I haven't given much detail about my environment in my initial message. My browser is Firefox 1.5. JSF vesion is 1.2 p5 (although I have seen this problem for quite some time, so I don't believe that the version of JSF is relevant). Web server is Tomcat 6.0. I also have disabled caching the page content, so the browser has to re-rendered pages everytime the user browses back and forward. Not sure if this is one of the issues. I know that when moving back with browser back button, a dialog always comes up saying that any actions carried out will be repeated.
    Martin

  • Dynamic component addition in JSF

    I have a loan application that I've done using JSF.
    The form has, among other things, fields for previous addresses as well as previous employers. Initially I'm only including enough fields for the user to enter 2 address and 2 employers.
    Since we're requiring that the user give us employers and addresses for the last 5 years this may not be enough.
    So I'm looking for the best way to allow the user to add more employers and addresses dynamically;
    An "add another address" link that when clicked returns a page with another address field, for example.
    I have a controller bean in which I could create many (say 10) employee and address beans but that's wasteful. And I experimented with a vector of employers and addresses but couldn't figure out how to do it.
    There must be a simple (JSF) way to do this.

    How about using the value of rows attribute of
    <h:dataTable dynamically by value binding or in a
    event handler method you could do:
    facesContext.getViewRoot().getChildren().add(component
    Thank you, i'll give it a try.
    I also found this thread to be helpful:
    http://forums.java.sun.com/thread.jspa?threadID=555626&messageID=2816029

  • Dynamically create selectManyCheckbox in jsf

    <address>Hai every one
    How can i dynamically create selectManyCheckbox using arrayList in jsf..
    How can i get the selected values and save to database... using jsf...
    Thank in advance..
    shashi
    </address>

    Write below code in backing bean
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.faces.model.SelectItem;
    public class DynamicListBean {
         private ArrayList dynList = new ArrayList();
         private SelectItem[]items;
         private List dList = new ArrayList();
         private String selectedCategory;
         public DynamicListBean()
              items=populateSelectOneMenu();
         public SelectItem[] getItems() {
              return items;
         public void setItems(SelectItem[] items) {
              this.items = items;
         public String getSelectedCategory() {
              return selectedCategory;
         public void setSelectedCategory(String selectedCategory) {
              this.selectedCategory = selectedCategory;
         public List getDList() {
              return dList;
         public void setDList(List list) {
              dList = list;
         public ArrayList getDynList() {
              return dynList;
         public void setDynList(ArrayList dynList) {
              this.dynList = dynList;
         public SelectItem[] populateSelectOneMenu() {
              String a = "B";
              List selectItems = new ArrayList();
              for (int i = 1; i < 5; i++) {
                   dList.add(a + i);
              Iterator it = dList.listIterator();
              while (it.hasNext()) {
                   String label = (String) it.next();
                   selectItems.add(new SelectItem(label));
              return (SelectItem[]) selectItems.toArray(new SelectItem[0]);
    write below code in jsppage
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <%String path = request.getContextPath();
                   String basePath = request.getScheme() + "://"
                             + request.getServerName() + ":" + request.getServerPort()
                             + path + "/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
         <head>
              <base href="<%=basePath%>">
              <title>
                   My JSF 'index.jsp' starting page
              </title>
              <meta http-equiv="pragma" content="no-cache">
              <meta http-equiv="cache-control" content="no-cache">
              <meta http-equiv="expires" content="0">
              <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
              <meta http-equiv="description" content="This is my page">
              <!--
         <link rel="stylesheet" type="text/css" href="styles.css">
         -->
         </head>
         <body>
              <f:view>
                   <h:panelGrid id="BatchesList" rendered="true">
                        <h:form>
                        <h:outputText value="Select Batch" />
                             <h:selectOneMenu value="#{dbl.selectedCategory}">
                                  <f:selectItems value="#{dbl.items}" />
                             </h:selectOneMenu>
                        </h:form>
                   </h:panelGrid>
              </f:view>
         </body>
    </html>

  • Dynamically displaying rows in jsf

    hi,
    I have arequirement in jsf like I have to display the rows dynamically when I click on Add New Product and also I have to display the products that are already added to the database. When I click on Add New I should be able to add the new product and after that i should be able to save the details to the database. Can I implement this using h:datatable tag?

    h:datatable is used to display an html table, but this is not enough to implement what you want.
    what do you need is a jsf tutorial to see how this framework (jsf) works.
    here http://www.coreservlets.com/JSF-Tutorial/ a very good tutorial.
    hope it helps

Maybe you are looking for

  • Error Codes after Apple Hardware Test...

    After someone here told me I've been experiencing kernel panics, I did some digging on the x lab site and re-ran the Apple hardware test in loop mode. after 17 runs, it returned the error: 4MOT/2/40000005:Right Side I can't seem to find a list of err

  • Thunderbolt to Gigabit Ethernet reconnect slow after sleep

    Hello, guys. I couldn't get the management of where I work to give me a working WiFi (they offered an insecure, unprotected WiFi... madness), so I had to opt for Gigabit Ethernet. I bought the Apple Thunderbolt to Gigabit Ethernet adapter for my 2012

  • Tax classification for sales order before ECC

    Hi expert, We have recently upgraded from 4.6C to ECC6.0 and noticed the following issue, please kindly advise. Thanks. The tax classification for one of the regular customer has always been maintained as '0' (Tax Exempt). In 4.6C, in the sales order

  • Use facebook integration with business page

    We would like to use the facebook integration to link to our business facebook page, that way we can easily monitor activity and share posts and photos directly from the desktop.  I can only get it to link to personal accounts of those who are manage

  • Tree with custom labels crashes during scrolling

    We have a tree that uses custom icons for different folder/data types. The tree contains about 150 items of around 15 types. The icons are assigned correctly and the tree works just fine. However: If we scroll the tree up and down, it eats up some re