Dynamic Component Creation Question

I have a process that looks up fields names from a database. I then loop through and create HtmlInputText components dynamically. The question I have is how do I create a value binding to these components? I have been trying to think of a way to create a separate class that can be applied to each field name I retrieve from the database. But I just can't think of a good solution for this. I assume people have had to do this before.
Thanks

Let it bind to a List<String> or Map<String, String>. To get/set elements in a List you can use the brace notation, e.g. #{list[0]} for the 1st element (list.get(0)). For map you can use the key name as propertyname, e.g. #{map.key} for the entry associated with key "key" (map.get("key")).

Similar Messages

  • Dynamic Table Creation Question

    Can you dynamically add a column to a data table at run time using JSC and JSF? I have a case where I want to add a column to a table based on a selection by the user.

    Hi
    I have been trying to this when I saw your question first time two days back. I tried changing the rowset's query but nothing seems to work. I will try again and I am sure that I can give you something on this if there is any straight solution to this.
    Thanks
    Srinivas

  • Dynamic component creation and population

    I'm trying to create a page such that , based upon some backing bean, a different component would be rendered and populated based upon a property in that bean.
    For instance
    public class MyBean {
      private int type;
      private String data;
      getters/setters...
    }Say the type can be sex (a radio button component), level of user (selectOne with the values of gold, platinum and silver) or location (a textfield) (these are an example of the type of data--there are many more entries that are of one of these three component types that need to be handled). I have a list of these beans that could go in a dataTable or whatnot, so I'd like to be able to dynamically generate the components. Does anyone have any suggestions or input?
    My guess is a component will need to be returned from the bean that describes how it should be rendered--I'm just looking for a jumpstart on the best way to do this, see if anyone has code snippets, references, etc.
    TIA.
    P.S. Apologies if this is posted twice...some errors when I tried to post this the first time...

    So, are you saying to have all three types of components in a given line of the datatable, wire each up to do have the appropriate values (male/female or silver/gold/platinum) and then have a rendered argument read a bean property such as isRadio, isSelect or isText and just render the appropriate one?

  • View Methods / Dynamic component creation

    Hi,
    I'm dealing with an issue I wasn't able to bypass for the moment:
    depending on the value of the parameters in the URL of my application, i need to pick
    a differrent component usage, and apply it in a view container on my main view.
    the problem is, that when i want to load the component usage, it has to be done
    before wddomodifyview, but there's no way to do it in de wddoinit, because whan that
    last one is called, my dohandledefault (to catch the url) is not yet executed.
    the components are now added in a method in my view (MAIN) is there a way to call
    this method from the dohandledefault? or is there another option? for example making
    the do_dynamic_navigation executed in a window method? Which gives at my side
    an error because the plugs are not defined (??)
    grtz
    Koen

    Hi Koen,
    WDDOINIT of the default view is called before the inbound plug handler of the window is called.
    You have 2 possible solutions:
    1. Declare an inbound plug at your view and declare it as "default" in your window assembly. Then this method is called later and you can create your component usages there.
    2. Do not set this view as default view, but embed an emptyview and set it to default. Then navigate to to new view in your window inbound plug.
    Ciao, Regina

  • Dynamic Component Creation

    Hi,
    Can someone tell me if there is a way to get the following code to work or another way to get the same effect? I want to be able to create buttons on demand, when the user clicks an "add" button.
    JPanel numpanel = new JPanel();
    int i;
    for(i = 1; i<13; i++){
    JButton ("num"+i) = new JButton(("Num-" + i));
    numpanel.add(("num"+i));
    }

    Do you need to hold a reference to the buttons or do yo just want to add them to the panel?
    If you just need to keep adding buttons, then use this:
    //asssume count is a class level variable
    numpanel.add(new JButton("Num-" + count++));If you need to hold a reference to each button (quite likely), then use an ArrayList/Vector to hold the buttons
    JButton b = new JButton("Num-" + count++);
    list.add(b);
    //--- list is the ArrayList that has been created and initialised.
    numpanel.add(b);When you need to retrieve any button, use list.get(i).

  • [CRM 5.2] Component Creation

    Hi Gurus,
    we encountered a problem during creation of a new component in SAP CRM 5.2!
    we've created a new ZComponent and generated a new overview page in view node.
    then we associated two external views of another component in Component Usages in Runtime Repository.
    After we associated them to the viewset, put them in the Configuration tab and finally we tested the component.
    We retrieve the followign error:
    Context initialization failed in view CRMCMP_GS_WC/SearchLinks
    An exception has occurred Exception Class  CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference 
    Method:  CL_CRMCMP_G_SEARCHLINKS_IMPL=>GET_NBS_LINKS 
    Source Text Row:  14
    Initialization of view CRMCMP_GS_WC/SearchLinks failed
    An exception has occurred Exception Class  CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference 
    Method:  CL_CRMCMP_G_SEARCHLINKS_IMPL=>GET_NBS_LINKS 
    Source Text Row:  14
    Cannot display view IFVSearchLinks
    An exception has occurred Exception Class  CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference 
    Method:  CL_CRMCMP_G_SEARCHLINKS_IMPL=>GET_NBS_LINKS 
    Source Text Row:  14
    Initialization of view IFVSearchLinks failed
    An exception has occurred Exception Class  CX_BSP_WD_RUNTIME_ERROR - View CRMCMP_GS_WC/SearchLinks could not be bound 
    Method:  CL_BSP_WD_VIEW_CONTROLLER=>BIND_VIEW 
    Source Text Row:  162
    Cannot display view ZCOCKPIT4/ZMYVIEW
    An exception has occurred Exception Class  CX_BSP_WD_RUNTIME_ERROR - View CRMCMP_GS_WC/SearchLinks could not be bound 
    Method:  CL_BSP_WD_VIEW_CONTROLLER=>BIND_VIEW 
    Source Text Row:  162
    Cannot display window ZCOCKPIT4/MainWindow.
    An exception has occurred Exception Class  CX_BSP_WD_RUNTIME_ERROR - View Search.IFVSearchLinks could not be bound 
    Method:  CL_BSP_WD_VIEW_CONTROLLER=>BIND_VIEW 
    Source Text Row:  162
    Do you know where is the issue? Do you know if there is a guide of component creation?  Can you help us?
    Thanks!

    Martijn,
    For questions on steps 1&3 they are related.  When you "enhance" a view on a component you actually perform the first step of making the component ready for enhancements.
    This is done by displaying the component and clicking on the "enhance component" button.  This creates a "Z" storage area for your enhancements.  I need to take a further look at the copy details to remember exactly where the copy should be stored.
    For your question 5, yes once you add it to the repository it will appear in your customizing.
    Well for that piece let's say it is a transaction list, that is an entirely new concept to make the list appear differently.  You would have to adjust the underlying bol objects to make that work.  By chance what is the name of the view that you are trying to copy and adjust?
    There are no books available, but you can buy electronic access to the OKP materials from SAP.  For more information goto service.sap.com/okp
    Good luck,
    Stephen

  • Dynamic component in WHERE-condition for LOOP AT ?

    i want to make
    loop at itab where  (dynamic field) > 0
    how i can make it...
    Edited by: Thomas Zloch on Mar 2, 2010 2:47 PM

    I thought it's funny.
    And the problem can maybe be solved by using a completely dynamic where-condition, not just a dynamic component.
    http://help.sap.com/abapdocu_70/en/ABAPLOOP_AT_ITAB_COND.htm#!ABAP_ADDITION_4@4@
    Thomas
    P.S. meaningless subject enhanced, and please take the time to say hi and please when asking for help. Thanks.

  • Dynamic Table Creation & Fill Up

    Hello,
    Can anyone please guide where I can find examples for dynamic table creation (programmaticaly), with dynamic number of columns and rows, used to place inside text components (or whatever) to fill them with data.
    All programmatic.
    Using JSF, ADF BC
    JDeveloper 10.1.3.1
    Thanks
    Message was edited by:
    RJundi

    Hi,
    Meybe this article helps: http://technology.amis.nl/blog/?p=2306
    Kuba

  • Web Dynpro Abap - Dynamic Component Usage - parameters

    Hi,
    I have a this scenario:
    by a main WD component (COMP_MAIN) I have to call others WD components (COMP_1, COMP_2, COMP_3,...)
    I use Dynamic Component Usage
    l_view_controller_api->prepare_dynamic_navigation(
                        source_window_name          = 'W_SC'
                        source_vusage_name          = 'V_SC_USAGE_1'
                        source_plug_name            = 'TO_USAGE'
                        target_component_name       = l_wa_cmp_usages-used_component
                        target_component_usage      = l_wa_cmp_usages-component_usage_name
                        target_view_name            = ls_cmp_usage_group-interface_view
                        target_plug_name            = ls_cmp_usage_group-inbound_plug
                        target_embedding_position   = l_wa_cmp_usages-embedding_position ).
    l_wa_cmp_usages-component_usage->create_component( l_wa_cmp_usages-used_component ).
    I ask :
    is possible to write context nodes of COMP_MAIN into COMP_x?
    If yes, how can I do that?
    Thank you
    Al

    Hi,
    Please go through below pdf document which will help in understanding the componenet usage in webdynpro ABAP.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33195f
    Hope it will help you.
    Raghu

  • Does Seeburger's SFTP adapter support dynamic filename creation

    Hi all,
    Does the SFTP adapter support dynamic filename creation.
    If yes, then do we have to use UDF's and are there any specific settings that have to be done in the SFTP communication channel.
    Please provide a blog which helps in the configuration process of the above case.
    thanks,
    younus

    Dynamic Creation of File using counter in Seeburger Variable:
    1. Configuration Needed in the Communication Channel:
    The process of dynamic creation of files can be done we have to select the following checkbox in the receiver channel:
    Dynamic Attribute in receiver Channel:
    Import the following modules:
    Localejbs/Seeburger/solution/sftp
    Localejbs/Seeburger/AttribMapper
    Localejbs/ModuleProcessorExitBean
    Enter  the desired file naming convention:
    Use the Parameter GetCounter("ID") to the place where the counter is expected to come.
    2. Configuration Needed in the SeeBurger Workbench:
    If the J2EE server is listening on a port different from 50000 (which is the standard for the SAP client 000), the port number must be configured:
    Login into the seeburger workbench using the URL
    http://<localhost>:<port number>/seeburger/index.html
    Select Property Store.
    Create or edit the following property:
    Parameter
    Value
    Namespace
    http://seeburger.com/xi/SeeFunctions
    Key
    provider.servlet.server
    Value
    http://localhost:50000/ (where the port number 50000 must be set
    accordingly to the J2EE server configuration).
    Note: The configured value (server URL) has to end with a slash (/). Otherwise,
    SeeFunctions will not work correctly.
    If we need to start the counter from any specific value , it can be configured in the SeeBurger workbench, this value can be maintained in Mapping Variables :

  • Does UCM support dynamic page creation on contributor mode.?

    Hi All,
    Does UCM support dynamic page creation on contributor mode.
    We want to create new pages and link it into the existing pages
    is that possible?
    Thanks
    ~Hari

    You can create new secondary pages in contributor mode - you would normally do this via a dynamic list fragment though technically you could also achieve it by switching region content and creating new data files. You can then use the linz wizard to link between pages.
    If you are talking about creating new primary pages and sections in your site then you would need to use something like Site Studio Manager fragment.
    Tim

  • RE: dynamic widget creation

    This is a good tech note about this on the Forte website.
    -----Original Message-----
    From: Matthew Middleton [SMTP:[email protected]]
    Sent: Friday, 25 June 1999 11:11
    To: [email protected]
    Subject: dynamic widget creation
    I have done a few windows with dynamic widget creation. Sometimes it
    seems I have to have done self.Open before, to get things to appear
    properly, and sometimes not.
    What I would like is a summation of the issues involved here so I can
    write such code without resorting to trial and error.
    with advance appreciation,
    Matthew
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Tech Note 5156, which I have attached for your information.
    -----Original Message-----
    From: Foster, Todd [SMTP:[email protected]]
    Sent: Saturday, 26 June 1999 1:27
    To: 'Jason de Cean'
    Subject: RE: dynamic widget creation
    ? What technote ?
    -----Original Message-----
    From: Jason de Cean [SMTP:[email protected]]
    Sent: Thursday, June 24, 1999 9:19 PM
    To: 'Matthew Middleton'
    Cc: 'Forte Users'
    Subject: RE: dynamic widget creation
    This is a good tech note about this on the Forte website.
    -----Original Message-----
    From: Matthew Middleton [SMTP:[email protected]]
    Sent: Friday, 25 June 1999 11:11
    To: [email protected]
    Subject: dynamic widget creation
    I have done a few windows with dynamic widget creation. Sometimes
    it
    seems I have to have done self.Open before, to get things toappear
    properly, and sometimes not.
    What I would like is a summation of the issues involved here so Ican
    write such code without resorting to trial and error.
    with advance appreciation,
    Matthew
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/>

  • Dynamic Implicit Structure Creation Question

    Hello,
    I was curious if it was possible to dynamically create an implicit structure where you might occasionally want to omit some keys from being added to the structure?
    I played around with using ternary operators in the structure creation with no luck.
    <cfset temp = {
         name = "Dave",
         (1 IS 1 ? "" : Job  =  "Superhero")
      } />
    The only way I can see doing this now would be to create the structure and then use StructKeyDelete on the keys I want to remove OR build structures the traditional way and cfif my way around the keys I don't want to add."
    Ex: <cfset structKeyDelete(temp,"Job") />
    or
    <cfset temp = structNew() />
    <cfset temp.name = "Dave" />
    <cfif 1 NEQ 1>
          <cfset temp.job = "Superhero" />
    </cfif>
    Does anyone know how to create dynamic keys in a structure while defining it implicitly?
    Thanks!

    I can think of at least one reason why this fails. If there is just one key-value pair, there will be a comma stranded at the end.
    You can of course tinker dynamically with the content of the keys of a struct and their respective values. However, a struct is an object, with set characteristics such as number of key-value pairs. So, it would be difficult to dynamically change the number of key-value pairs 'from within' the struct. Even if what you are trying to do were possible, it would be more complex, and would certainly involve more code, than the ordinary alternative you mention.
    In any case, here is a version of your original idea that works:
    <cfset temp = (1 IS 2 ? {name="Dave"} : {name="Dave",Job="Superhero"})>
    <cfdump var="#temp#">

  • Reentrant page question (dynamic component generation related).

    I am trying to build a test site where a question will be asked on a page then submitted, then the next question will show up on that same page then submitted, until all of the questions are answered.
    Since each question can have a variable number of answers, I decided to dynamicaly build the answer list as a group of radio buttons. The first time I come to the test page, everything works just fine. The question along with the radio buttons that correspond to the possible answers show up, but when the user hits submit, instead of the next question showing up, the same one continues to display every time.
    I verify that in the test page's constructor the next question is being loaded and the old components are cleared out before I rebuild them.
    The entire code in the test page's constructor looks something like this:
            Map testToQuestionMap = session.getTestNameToRandomizedAnswersListMap();
            String selectedTest = getSessionBean1().getSelectedTest();
            int    currentIndex = getSessionBean1().getCurrentQuestionIndex();
            List questionList = (List)testToQuestionMap.get(selectedTest);
            Question question = (Question)questionList.get(currentIndex);
            //Clean up the page
            questionGrid.getChildren().clear();
            //Ask the question
            StaticText questionText = new StaticText();
            questionText.setValue(question.getQuestion());
            questionGrid.getChildren().add(questionText);
            List answerList = question.getAnswerList();
            Iterator answerIter = answerList.iterator();
            while(answerIter.hasNext())
                RadioButton rb     = new RadioButton();
                String      answer = (String)answerIter.next();
                rb.setLabel(answer);
                rb.setName("RBG1");
                questionGrid.getChildren().add(rb);
        }So, what do you need to do to allow the same page to be updated dynamically each time it is called besides what I am already doing?
    Is it a caching thing maybe?

    Well, since no one knew how to do this, what I ended up doing was creating a second page and alternatiing between the original and that one for each question. Not the most elegant solution, but it does work.

  • Dynamic Table Creation using RTTS - Question on Issue

    I am using the RTTS services to dynamically create a table.  However, when I attempt to use the get_components method it does not return all the components for all tables that I am working with.
    Cases and End Results
    1) Created structure in data dictionary – get_components works.
    2) Pass PA0001, P0001 or T001P to get_components and I do not receive the correct results.  It only returns a small subset of these objects.  The components table has all the entries; however, the get_components method only returns about 4 rows.
    Can you explain this and point me to the correct logic sequence? I would like the logic to work with all tables.
    Code excerpt below:
    The logic for the get components works for case 1, but not case 2. When I pass into this method a "Z" custom table or structure name for parameter “structure_name” and the get_components() method executes and returns the correct results. However, when I pass in any of the objects listed above in case 2, the get_components method does not return the correct number of entries. When I check typ_struct which is populated right before the get_components line, I see the correct number of components in the components table. 
    method pb_add_column_headings .
      constants: c_generic_struct type c length 19 value 'ZXX_COLUMN_HEADINGS'.
      data: cnt_lines      type sytabix,
            rf_data        type ref to data,
            typ_field      type ref to cl_abap_datadescr,
            typ_struct     type ref to cl_abap_structdescr,
            typ_table      type ref to cl_abap_tabledescr.
      data: wa_col_headings type ddobjname.
      data: rf_tbl_creation_exception type ref to 
                                      cx_sy_table_creation,
            rf_struct_creation_exception type ref to
                                      cx_sy_struct_creation.
      data: t_comp_tab type
                       cl_abap_structdescr=>component_table,
            t_comp_tab_new      like t_comp_tab,
            t_comp_tab_imported like t_comp_tab.
      field-symbols: <fs_comp> like line of t_comp_tab,
                     <fs_col_headings_tbl> type any table.
    **Get components of generic structure
      wa_col_headings = c_generic_struct.
      typ_struct ?= cl_abap_typedescr=>describe_by_name(
                                       wa_col_headings ).
      T_COMP_TAB = typ_struct->get_components( ).
    **Determine how many components in imported structure.
      typ_struct ?= cl_abap_typedescr=>describe_by_name(
                                        structure_name ).
      t_comp_tab_imported = typ_struct->get_components( ).
      cnt_lines = lines( t_comp_tab_imported[] ).

    Hi Garton,
    1. GET_COMPONENT_LIST
       Use this FM.
       It gives all fieldnames.
    2. Use this code (just copy paste)
    REPORT abc.
    DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
    DATA : pa0001 LIKE TABLE OF pa0001 WITH HEADER LINE.
    CALL FUNCTION 'GET_COMPONENT_LIST'
      EXPORTING
        program    = sy-repid
        fieldname  = 'PA0001'
      TABLES
        components = cmp.
    LOOP AT cmp.
      WRITE :/ cmp-compname.
    ENDLOOP.
    regards,
    amit m.

Maybe you are looking for

  • HP Color LaserJet CP1518ni & Windows 7

    Hi, I was hoping someone could give me an update on when the full drivers for this printer would be available. The last information I was given was that they would be available late January. Anyone know anything? Thank You, Tracy

  • I cannot install/upgrade Adobe Flash Player

    An email came to me with something sent on Adobe.  I could not open it because I needed an update on my Adobe Flash player.  I tried to update it and nearly finish with the installation when I keep getting the message that I need to close Safari  whi

  • BW - Crystal Reports Connection

    Dear all, we have cubes in BW , where i need to get reports on crystal reports server. What should i do to establish connection between 2 systems? Any document about it? or brief explanantion? Thanks

  • Spry validation custom functions

    I see that there is a way to specify a custom function to a spry validation widget like so: var customFunction = new Spry.Widget.ValidationTextField("customPasswordFunction", "custom", {validation: passwordStrength, validateOn:["blur", "change"]}); I

  • I want to use f9 to insert

    This should be easy, but I can't seem to find the location to change the settings. Currently, when I hit the f9 key, OS Tiger shows me windows of all active apps. I want to go back to the f9 key allowing me to insert a clip from the viewer onto the t