Generic component IDs - myFaces

Hi,
I've been wandering around several days to find out how i can find a good solution for tackling following problem;
I've a component let's say a commandlink component. According the tld specification the value of the id can only be a static value. What I want to do is have there a variable ID, suppose <h:commandLink ID="#{someBean.someGeneratedID}"/>
Is there a way to accomplish this, a work-around? Do I need to write a custom renderer or convertor? I've no idea how to solve this issue.
I'm new to JSF, I use to work with JSP and Struts so in that environment there is no problem for this "ID issue".
Any comments/ ideas/ links to threads I might have missed are welcome to help this newbie out!

The only way i'm seeing for to do what you whant is to add programatically the components to the page, that wahy you can give the id's in a more dynamic way.
Or you can change the id's programatically, although i don't know if this works. USe binding in each of the components. Then you can access them and alter several properties, amongst wich the id.

Similar Messages

  • Create generic component to handle errors after using the function modules

    Hi,
    Please provide steps to create a generic component to handle the BAPI Return structure meesages after the function calls..
    Please let me know how to pass the structure or internal table from one component to other.
    Thanks in Advance,
    SV
    Moderator Message: No Step-by-steps will be provided here. Either take a classroom course or search for SAP Documentation
    Edited by: kishan P on Dec 10, 2010 3:14 PM

    Hi Hari,
    Plz give me ur mail id.. i will forward some documents regarding Generic Extraction using FM  and query...
    For function module means.. you have to  create function module. in RSAX..in R/3 side
    and you want to extract data using Query means...you have to create Infoset query in (SQ01,SQ02,SQO3) IN r/3 Side
      you can refer this blog also..
    to Function module "RSAX_BIW_GET_DATA_SIMPLE" and there is very good weblog . Search "generic extraction" for weblog. /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    thanks
    @jay

  • Generic component in a List

    I would like to know how I can insert a generic component
    (like a Canvas whit image and label) in a List visual component.
    Is it possible or there's another way for to do a list of
    component ?

    You want to use an itemRenderer. For example, suppose each
    record of the data to be displayed in the list is like this:
    {label:"Some Label", image:"URL to an image"} then you could do
    this:
    <mx:List ... >
    <mx:itemRenderer>
    <mx:Component>
    <mx:Canvas>
    <mx:Label text="{data.label}" x="0" y="0" />
    <mx:Image source="{data.image}" x="0" y="20" />
    </mx:Canvas>
    </mx:Component>
    </mx:itemRenderer>
    </mx:List>
    The formatting in these messages makes it hard to see the
    relationships. But look up itemRenderer in the help for more
    details.

  • I would want to capture the reference of memory of a generic component ?

    I would want to capture the reference of memory of a generic component
    example1 ->{javax.swing.JScrollPane@678 }
    example2 ->{javax.swing.JTextField@577 }
    ecc..
    Thanks

    I would want to capture the reference of memory of a
    generic component
    example1 ->{javax.swing.JScrollPane@678 }
    example2 ->{javax.swing.JTextField@577 }
    ecc..
    Thanksuse an Objectit is the closest thing in the language to a memory reference
    all EventListeners have a getSource() method that yields an Object
    Furthermore anything allocated with new descends from Object
    For example, lets say you added the same ActionListener to 3 different buttons
    You could test which button triggered the action as follows
    Let e be the ActionEvent passed to the ActionPerformed method of an ActionListener
    if (e.getSource().equals(jButtonOne)){; // jButton1 actions
    } else if (e.getSource().equals(jButtonTwo)){;//jButton2 actions
    } else if (e.getSource().equals(jButtonThree)){;//jButton3 actions
    }The equals method of Object is the Java idiom for comparing memory references.

  • Should Component Ids  be less than 7 characters?

    Hi,
    When I name the ids of various ADF Faces components more then 7 characters, the jdev compiler shoots out warning messages that component Ids should be less than 7 for optimal performance.
    Is this correct? What implications does it have if all the component Ids are less than 7 characters long?
    regards,
    Ansuman

    Simon is correct on all counts.
    The choice of 7 as the upper limit is fairly arbitrary. We were running into cases internally where ADF Faces users were choosing very long/descriptive (15-20 character) ids for naming containers. This ended up showing up during server-side profiling, and also resulted page content size bloat, especially for ids of root naming containers like page templates which appear everywhere. The audit rule was added to help clue folks in to the fact that there are consequences when choosing long ids.
    Personally, if I were designing a page, I would always choose very short (eg. 1-2 characters) ids for my naming containers (and relatively short ids for anything that is going to be stamped repeatedly).
    BTW, the audit rules are configurable. If you happen to be unhappy with a particular audit rule, you can disable it. See Preferences->Audit->Profiles->Rules->ADF Faces->Check for long ids on naming containers. And of course, you can also add your own audit rules to reflect your preferred coding standards.
    Andy

  • Problem in running TreeTable component with Myfaces

    Hi,
    I am trying to run treeTable component of adf with Myfaces.
    The tag is rendered but not functioning properly.
    It shows one level expanded as mentioned below :
    > H1 // H1 has 2 related records
    +> H2 // H2 has 3 related records
    +> H3 //H3 has 1 related record
    but when I click on H2 then It is not expanding.
    Please Help.
    Regards,
    Sachin

    The treeTable component is working.
    The problem is due bcoz of following code::
    <!-- <af:column>
    <f:facet name="header">
    <h:outputText value="Map Link"/>
    </f:facet>
    <h:outputText id="button" value="Map" onclick="showOnMap(this);" />
         <h:inputHidden id="primary-key" value="#{foo.assetId}"/>
    <h:inputHidden id="assetType" value="#{foo.assetType}"/>
    </af:column>
    -->
    when I comment the above mentioned column the page is rendered and treeTabel is working properly.
    Can anybody help why the above mentioned tags are doing problem?
    Regards,
    Sachin

  • Length of component IDs

    Hi,
    I recall that there used to be a suggestion not to go over 7 characters for component ID for performance reasons. I also recall that JDev 11G was used to give a warning when you go over 7 chars at some point.
    With the current release(build 5407) it doesn't give this warning and the tool itself gives longer default IDs for components like lineGraph,pivotTable etc..
    I wonder whether that suggestion is still valid or not.. Should we worry about this? We would like to give more meaningfull names to our components if this is not an issue any more.
    Thanks

    Hi,
    Exactly for the button and input components. Actually, we use the most explicit id possible for the latter like email for email fields, firstName and so on. this often help the browser's auto-complete engine which is a boon for some users. The hint for NamingContainer is because those ids are used as prefixes for their children's clientId, so if you have 3 NamingContaines within each others, you could end up with client ids looking like:
    thePageMainTemplate:theMainContentRegion:theDataTable:<componentId>
    Now imagine the table contains 30 rows of 5 columns each including 3 component, then you end up with 54 characters for NamingContainer ids, so: 54 characters * 30 rows * 5 columns * 3 components = ~24kb only for the ids NamingContainer parts on the table. If you reduce each id to 3 characters, you get: 12 characters (3 char * 3 naming containers + 3 separators) * 30 rows * 5 columns * 3 components = ~5kb
    As for the NamingContainer, you have to check the UIComponent classes themselves. The most known, however, are <af:table/>, <af:pageTemplate/>, <f:subView/>, <af:region/>, <af:iterator/> and such.
    Regards,
    ~ Simon

  • Programmatically assigning ADF component IDS

    Hello,
    I have created a JSP using JDeveloper 10.1.3 that uses an include tag i.e. <%@ include file="/newpdrobjblock.jspf"%> to pull a JSP fragment.
    Ideally I would like to have multiple includes of this fragment on the page typically using an iterator eg <af:forEach items="#{sshrSessionData.pageButtonModels}" var="current1"> and to set all the fragment attributes (such as table bindings etc) using Expression Language (EL).
    This would aid my design in that I would have one reusable page fragment as opposed to (in this case) six dedicated fragments.
    The problem I am facing is that the facet ID's will not be unique. I know that EL is not an option for the ID (it is not supported) and my attempts to interogate and set the ID uniquely using a Managed Bean have not been successful. I can get the ID's but cannot set them. At a guess I would say that the call to the managed bean occurs too late in the cycle?
    Would anybody know if this can be achieved programmatically? Any thoughts would be very much appreciated.
    Pete

    John,
    You are quite right in that I can get around my initial problem by use of a naming container. If I code something like this:
    <f:subview id="block1">
    <%@ include file="/newpdrobjblock.jspf"%>
    </f:subview>
    <f:subview id="block2">
    <%@ include file="/newpdrobjblock.jspf"%>
    </f:subview>
    all is fine i.e. no problem with duplicate IDS and that was the real show stopper for me.
    I wiil look at the use of 'foreach' to simplify my design but either way I can now look at reuse of fragments by use of expression language.
    Thanks again for you help.
    Pete

  • Layer id to component id in Flex

    For designers is imperative to give individual names to layers, the thing is that these "names" in Flex continue as layer ids instead of being used as component ids (which would cut ALOT of work!!!). Please! Change this!!!!!

    Well it would help save time in the development stage just by allready exporting components ids that can be used by Flex, instead of having to create from scratch the ids. I found this helpfull because i'm working with a developer and he noticed that, as every good designer, my layers have a logical naming that he could use as components ids IF Flex could use the layer's id as a component id (since the component in FC ocuppies a layer that I name specificly. If Flex could use the "search and change key words" to search for the layer's ids and automatacly change them to component's ids it wouldn't matter, but since Flex doesn't do that, and since every great FC project has to pass through Flex....
    The point is that instead of having the both of us entering ids it would only be necessary for me to do it.
    Or at least have a Flex transition window where i could, in FC, atribute the id i want to the component.
    If i've not made myself clear i'm not talking about a generic component as you can se in the library. What i'm talking about is, for example, if I had 3 main buttons, all from the same component, in different layers (of corse), and if i named those 3 layers as "home_bt", "contacts_bt" and "faq_bt", when the project got imported to Flex, Flex would recognize the layer's ids as being each duplicate component's id in Flex....
    I hope you understood me. My guess is that you guys are trying to make FC as a softer flash for non-flash users/ designers, and Flex as the developers tool, separating the too worlds that today are a bit mixed, demanding programing skills for designers and designing skills for programmers....my guess is that this is a pertinent issue in the separation of these two worlds....and me, as a designer, can help in the developing stage better and faster

  • Create dynamic ID for component / component names in portlet

    Hi,
    I developed a JSF and IBM Portal API based portlet which runs on Websphere Portal Server 5.0.2.2. Everything's fine, if I have just one instance of my portlet on the page. If I have more than one, problems arise...
    This is due to the component IDs which are the same for each portlet instance. I blame IBMs Gerneric faces portlet for this behavoir, but this doesn't solve my problem ;-)
    So I need to create unique IDs for the components for each portlet instance on a page - which means at runtime.
    I thought of a custom component which is generates a unique random ID. The final structure of a page (or JSF component tree) with multiple instances of my portlet should look like this
    root
    |
    + mycomponent id=3454         \
    |  +- form id=form1            | - Portlet instance A
    |     +- input id=textinput1  /
    |    
    + mycomponent id=7656         \
       +- form id=form1            | - Portlet instance B
          +- input id=textinput1  / With this kind of component tree I could distinguish the form in portlet instance A and instance B (for A it would be 3454:form1 and for B 7656:form1)...
    Because there's no real servlet or portlet-code which can be altered, the points to interfere are quite limited. As mentioned above, all general request handling and forwarding to JSPs is handled by the "generic faces portlet"...
    The first point where my own code could be executed is in a custom component on the JSP or the "onPageLoad"-Event of hx:scriptcollector (which is an IBM extension to the standard JSF components).
    Have you any suggestions or best practices how to solve this problem?
    TIA,
    ulkbold

    Did you ever come up with a way to workaround this problem. This problem just bit me over the weekend.

  • How to get values from dynamic component?

    Hi:
    I am displaying dynamic components based on user selection, where InputText and OutputText display properly. But now i want to read that component value on
    button click. Can any body help me in that?
    Source code is as follow,
    text.xhtml
    *<code>*
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:p="http://primefaces.prime.com.tr/ui"
         xmlns:ice="http://www.icesoft.com/icefaces/component"
         template="/WEB-INF/includes/templates/page-template.xhtml">
         <ui:define name="page-content">
              <div class="exampleBox splashContainer"
                   style="background: url('./xmlhttp/css/rime/css-images/contentContainer_bg.gif') top repeat-x">
              <table>
                   <tr>
                        <td colspan="2">
                        <h2>Set Request Process Flow</h2>
                        </td>
                   </tr>
                   <tr>
                        <td colspan="2"><ice:messages style="color:red;" /></td>
                   </tr>
                   <tr>
                        <td><ice:outputText value="Request Type*"></ice:outputText></td>
                        <td><ice:selectOneMenu value="#{offlinereq.requestno}"
                             valueChangeListener="#{offlinereq.requestChange}"
                             partialSubmit="true">
                             <f:selectItem itemValue="" itemLabel="--Select--" />
                             <f:selectItems value="#{offlinereq.requests}" />
                        </ice:selectOneMenu></td>
                   </tr>
                   <tr>
                        <td>*<h:panelGroup binding="#{offlinereq.panelBind}">*
    *                    </h:panelGroup>*</td>
                   </tr>
                   <tr>
                        <td colspan="4"><ice:commandButton value="Add"
                             actionListener="#{offlinereq.add}" /> <ice:commandButton
                             value="Update" actionListener="#{offlinereq.update}" /> <ice:commandButton
                             value="Delete" actionListener="#{offlinereq.delete}" /> <ice:commandButton
                             value="Reset" actionListener="#{offlinereq.reset}" /></td>
                   </tr>
              </table>
              </div>
         </ui:define>
    </ui:composition>
    *</code>*
    bean.java
    *<code>*
    //ValuechangeListener
         public void requestChange(ValueChangeEvent e){
              System.out.println("Select Value is::"+e.getNewValue()+"::"+userid);
              Connection conn=null;
              try {
                        if(!panelBind.getChildren().isEmpty())
                             panelBind.getChildren().clear();
                   Class.forName ("oracle.jdbc.OracleDriver");
                   conn = JdbcUtil.getConnection();
                   Statement stmt = conn.createStatement();
                   String sql="select * from IB_CUSTOMER_REQUEST_PARAMETERS where IB_REQMAST_SRNO='"+e.getNewValue()+"'";
                   ResultSet rs = stmt.executeQuery(sql);     
                   String out="out";
                   int i=1;
                   String ii;
                   while(rs.next()) {          
                        FacesContext facesContext = FacesContext.getCurrentInstance();
              Application application = facesContext.getApplication();
              HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE);
                   grid.setColumns(2);
              HtmlOutputText output = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
                   output.setValue(rs.getString("IB_CUSTREQSTPARA_NAME"));
                   ii=Integer.toString(i);
                   output.setId("a"+ii.toString());
                   System.out.println("id"+ii);
                   HtmlInputText input = (HtmlInputText)application.createComponent(HtmlInputText.COMPONENT_TYPE);
                   //input.setValue(rs.getString(1));
                   grid.getChildren().add(output);
                   grid.getChildren().add(input);
                   panelBind.getChildren().add(grid);
                   i++;
              catch(Exception e1)
                   System.out.println(e1);
         //Action listeners
         public void add(ActionEvent e)
              System.out.println("ADD");
    *</code>*
    Thank You,
    Anup

    Where are you stuck? find the component (UIComponent.findComponent) in the JSF component tree by its ID and get the value from it. This article might help:
    http://illegalargumentexception.blogspot.com/2009/02/jsf-working-with-component-ids.html
    Note: the code tag is \                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Dump: Component not found

    Hello all,
    I have a strange error in my Web Dynpro application. It dumps with the message "Component ID_00010003000700080011 not found". I can reproduce this error, but I don't know why it happens, because it dumps only on test machine, not on development machine. I thought it's a missing transport request, but I have released all requests to test machine.
    Dump anlaysis (ST22) is not very helpflull, it says the error is "CX_WDR_RT_EXCEPTION", not very much else. I searched in SAP notes, but no luck either.
    Has anybody an idea, how such an error with component IDs can happen?
    Best regards and TIA, Matthias

    Hi Volker,
    I solved the problem with lots of debugging. At the end it seemed that the problem was in a RFC-function by another project, they solved this error. So it was no ABAP or WD4A problem, as I thought at the beginning.
    Regards, Matthias
    PS: I always give reward points to the helpful answers...

  • h:dataTable with component binding not rendering

    Hello,
    I am developing an application with several ad-hoc queries that need to be displayed in data table elements. The number and label values of the columns are not known until runtime. I am attempting to use a component binding mechanism to intercept the UIData and add columns to it at runtime, depending on the data currently held in a backing bean instance (such as an ad-hoc query result).
    I'm not sure where I can actually intercept the table and add the columns. I've got the following code example to compile and run without error, but nothing gets rendered properly - I get an opening <table> tag in the HTML source and nothing else follows.
    I have compared the structure of the table created with the following binding method to a table created with simple <h:dataTable> tags, and I see only one difference. The datatable created with tags has a single attribute in its attribute map called "javax.faces.webapp.COMPONENT_IDS" that maps to an ArrayList of the component IDs of the h:column elements I specify on the JSF page. The datatable I attempt to create in the binding method does not have this attribute in its map, and I can't seem to manually add it in without creating further havoc. (the child count, types of children, etc all seem to be equivalent).
    From the JSF perspective this is how I've defined the h:dataTable tag instance...
    <h:dataTable id="categoryTable" rendered="true"
            binding="#{backingBeanInstance.table}"
                value="#{backingBeanInstance.rows}"
                    var="row"  border="2" />This is basically the code in the backingBeanInstance....
        private UIData table;
        public void setTable(UIData table){
            this.table = table;
           //initTable();   //tried this but seems not to work either?
        public UIData getTable(){
            if(table!=null){
                initTable(); //build the columns and add to the table
            return table
        private void initTable(int categoryIndex){
                //This block is just a way to calculate the number of columns
                int colCount = <depends on data held in bean>
                //Resolve the var string for the data table
                String item = table.getVar();
                System.out.println("item: " + item);  //this is always null the 1st time through?? why?
                UIColumn col;
                UIOutput out;
                FacesContext context = FacesContext.getCurrentInstance();
                Application app = context.getApplication();
                //For each column in the data, create a UIColumn as child of the
                //data table.  Create a UIOutput as child of the UIColumn and bind
                //the value of the UIOutput to the data with an EL expression
                for (int j = 0; j < colCount; j++) {
                    //create an instance of UIOutput to display the value for this cell
                    out = new UIOutput();
                    out.setRendererType("Text");
                    //create an instance of UIColumn
                    col = new UIColumn();
                    //construct the value binding string as an EL expression
                    String valueBindingString = "#{" + item + "[" + j + "]}";
                    //create the value binding
                    ValueBinding vb = app.createValueBinding(valueBindingString);
                    //set the value binding on the UIOutput object
                    out.setValueBinding("value", vb);
                    //add the UIOutput component to the UIColumn as a child
                    col.getChildren().add(out);
                    //add the UIColumn to the data table as a child
                    table.getChildren().add(col);
        }

    <bump>

  • Component AV Cable

    I have a Sony Trinitron 32" CRT TV with component video in.
    I just tried connecting an iPod Classic to the TV with the Generic Component AV Video Cable. I have audio...but no video.
    Is something wrong here? Is the iPod Classic pushing out a signal? Is there a way to tell the iPod Classic that I want sent the image to the TV?
    Thanks
    xmennight

    I'm actually having the same problem, though I bought the specific Apple connectors, dock, and remote in a package, in connecting it to the yellow, white, and red a/v inputs on the front of my television I only hear the audio playback, no video appears on the screen. Though other devices I connect this way play back video. I would like some clarification on this also. The video playback on my ipod is fine, however with downloading movies, television shows,video pod casts and such I would like to get this to be able to work with our main television in the home. I would also appreciate any suggestions anyone would have. I've connected to other televisions in the house and I still just come up with audio, no video.
    Thanks!

  • Use  Of component key in OSM

    Hi..
    I am looking for some help here.
    Can any one let me know how can i use component ID to create the Multiple instance of a function like one for Mobile and another for PSTN. Did not understood by material available so posting query here.
    Thanks
    Edited by: 990693 on May 10, 2013 1:25 AM

    Hi,
    Each instance of a function has a different component ID. This component ID is either auto-generated through decomposition or enforced through configuration/xquery.
    So, as far as I understood your question, you want to generate two instances of a function based on product (mobile or PSTN). I think of two ways to do it:
    1) Use two decomposition rules, each one for each product specification, so you separate these two products into two order components
    2) Use xquery to generate distinct component IDs based on the product
    I would recommend you to go with the first solution.
    Regards,
    Leandro

Maybe you are looking for