Command Link attribute is returning null.

Hi all,
I have a pojo iterator with me. I have to generate command link for a attribute from that iterator. I generated them using a ForEach loop as below and put address of employee as an attribute of that tag. Now in the Action Listener i am fetching this attribute using actionEvent as below : -
    public void displayUploadAttachment(ActionEvent actionEvent) {
       System.out.println("Content Id:- "+actionEvent.getComponent().getAttributes().get("adr"));
My action Listener returns it as NULL. I am not getting why it is doing this.
<af:forEach items="#{bindings.myEmpIterator.children}"
                              var="emp">
                    <af:commandLink text="#{emp.firstName}" partialSubmit="true" id="cl22"
                                    actionListener="#{viewScope.empBean.displayEmpAddress}">
                    <f:attribute name="adr" value="#{emp.address}"/>
                    </af:commandLink>
                  </af:forEach>
J dev version
Studio Edition Version 11.1.1.6.0

Hi,
Couple of things to check.
1. Check if the address is really null (instead of #{emp.firstName} as text for the commandLink, try with #{emp.address}).
2. Instead of
System.out.println("Content Id:- "+actionEvent.getComponent().getAttributes().get("adr"));
try
System.out.println("Content Id:- "+((RichCommandLink)actionEvent.getSource()).getAttributes().get("adr"));
-Arun

Similar Messages

  • Need Help ::  Current row attribute value returning null

      Hi Frds,
    I am facing the problem that
    Current row attribute value returning null............ even though value is there..... plz.. he
    This is the code in PFR
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
        String  pPersonId = pageContext.getParameter("ctrlPersonId");
         String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
         OptionsVORowImpl curRow = (     OptionsVORowImpl) am.findRowByRef(rowReference);
        String dtlsItem =  (String)curRow.getFlexValue();   /*  this is returning null value */
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks & Regards,
    jaya
    Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810

    Hi Jaya,
    You want to catch Flexfield values?
    Try below code for catch value.
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
    OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
    OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
    OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
    String dtlsItem  = (String)Stylebean.getText(pageContext);
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks,
    Dilip

  • Transient vo attribute binding returning null

    i have a editable form with multiple input text components which i created by dropping a collection on page.
    now i want to add more fields which are transient and read only.
    i added two transient attributes in VO with Updatable to Never and queryable to true, i dont have the logic yet so the expression is blank. i created a label using control hint.
    now i created two attribute value bindings for these new fields.
    i created two input text fields and used these bindings for their label , value properties. i set readonly and disabled both true for these input text fields.
    if i hard code the label and value properties of input text it works, if i use binding expressions for them, it throws some error saying could not find binding for transient fileds or thery returned null.
    what stpes should i use to add a transient field to a editable form.
    jdev 11.1.1.5.0

    Put the transient attributes into the underlying eo, refresh the vo and add the attributes from the eo to the vo. Now they should work just as any other attribute.
    Timo

  • Get attribute name from VO returns null.

    Hello,
    I'm using JDeveloper 11.1.1.3. I have an af:inputfile component in which i set a ValueChangeListener. I'm using the attribute "Filename" from the form view to set the name of the file before saving it to a directory. At first, i had a different layout for my jspx page (very similar in design) and everything was working perfectly. When i redesigned the page, i'm now getting "null" as the filename. I'm not able to get the attribute! Although i didn't change anything in the code! I tried writing a simple method to output the attribute:
          public String justOutput(){
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("Filename");
            if (attr == null)
                return null;
            String filename = (String) attr.getInputValue();
            System.out.print(filename);
            return null;
          }It was able to output the attribute. But in my original method i'm getting "null".
    ******Another important observation*******
    If i pressed upload another time at runtime and uploaded another file it works again!
    Here is my code:
         public void uploadFile(ValueChangeEvent valueChangeEvent)  {
              InputStream in;
              FileOutputStream out;   
              ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
              String fileLoc = context.getInitParameter("DATA_DIR");                 
              UploadedFile file= (UploadedFile)valueChangeEvent.getNewValue();                           
              boolean exists = (new File(fileLoc)).exists();
              if(!exists){
                (new File(fileLoc)).mkdirs();
              if(file != null && file.getLength() > 0){
                FacesContext context2 = FacesContext.getCurrentInstance();
                FacesMessage message = new FacesMessage("File Uploaded" + file.getFilename() +
                                                        "(" + file.getLength() + "bytes)");
                //context2.addMessage(valueChangeEvent.getComponent().getClientId(context2), message);
                BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("Filename");
                if (attr == null)
                    return;
                String filename = (String) attr.getInputValue();
                try {
                         out = new FileOutputStream("C:\\demos\\" + filename + ".pdf");
                         in = file.getInputStream();
                         for (int bytes=0; bytes < file.getLength(); bytes++) {
                             out.write(in.read());
                         in.close();
                         out.close();
                     } catch (IOException e) {
                     e.printStackTrace();
              else {
                  String filename = file != null ? file.getFilename():null;
                  String byteLength = file != null ? "" + file.getLength():"0";
          }I don't think the code is wrong because it worked before. But why is this happening?
    Can anyone please help!?
    Mohamed.

    Sorry for the late reply Frank,
    Thanks for your reply, no i didn't! But it worked when i set the 'autosubmit' property to true... Like you said:
    the name field hasn't updated the model to the time you try and access itThanks again.
    Mohamed

  • TotalVHDCapacity attribute is returning zero in "Get-SCVMTemplate | select Name, TotalVhdCapacity" powershell command though the Vhd capacity is 20 gb in size, vmm 2012 r2

    Hi All,
    TotalVHDCapacity attribute is returning zero in "Get-SCVMTemplate | select Name, TotalVhdCapacity" powershell command though the template has Vhd capacity is 20 gb in size, vmm 2012 r2. I can create VM using this template too.
    For other templates it is returning correct value though.
    Can anyone help us understanding the root cause and the solution too.
    Thanks in advance.
    Debabrata

    I booted this drive from another computer (Asrock M3A770DE mobo) and works fine, speed with dd was ~100MB/s
    I also update bios on my first computer with Intel D945GSEJT (there is selected AHCI mode) still the same transfers with dd (~10Mb/s)
    I have no idea what to do with it now
    EDIT:
    More tests with other hdd (Samsung HD502IJ), dd on mounted NTFS partition:
    Intel D945GSEJT booted from Archlinux iso:
    hdparm: ~75 MB/s
    dd: ~10 MB/s
    Intel D945GSEJT booted from Archlinux iso, HDD connected to PCI SATA controller (Promise 378):
    hdparm: ~60 MB/s
    dd: ~10 MB/s
    Asrock M3A770DE booted from Archlinux iso:
    hdparm: ~87 MB/s
    dd: ~76 MB/s
    Asrock M3A770DE booted from Archlinux iso, HDD connected to PCI SATA controller (Promise 378):
    hdparm: ~81MB/s
    dd: ~76 MB/s
    What is broken on D945GSEJT?
    Last edited by miskoala (2012-03-30 13:47:23)

  • Generating dynamic command links in data table

    Hi,
    I have a requirement to generate dynamic number of columns in a datatable. Also these columns should contain a command link.
    I have written following piece of code to do so...
    public UIData getDataTableBinding()
         UICommand comm = null;
         UIColumn col;
         UIOutput out = null;
         Application app = app = FacesContext.getCurrentInstance().getApplication();
    // Suppose I want to generate 7 columns
         for(int j = 0; j < 7; ++j) {
         out = new UIOutput();
         col = new UIColumn();
         comm = new UICommand();
         ValueBinding vb = app.createValueBinding("#{" + j + "}");
         out.setValueBinding("value", vb);
         out.setRendererType("javax.faces.Text");
         comm.setRendererType("javax.faces.Link");
    comm.getChildren().add(out);
         MethodBinding mbButton = app.createMethodBinding("#{pc_File1.doLink1Action}",
    null);
         comm.setAction(mbButton);
         col.getChildren().add(comm);
         dataTableTemp.getChildren().add(col);
         return dataTableTemp;
    I have bound the "binding" attribute of the data table to getDataTableBinding()
    method.
    If I remove all the references to UICommand i.e comm variable, table is displayed properly, but if
    I try to include a command link component as mentioned above I get "Assertion failed error"
    SRVE0068E: Could not invoke the service() method on servlet Faces Servlet. Exception thrown :
    javax.servlet.ServletException: javax.faces.el.EvaluationException: Error getting property
    'dataTableBinding' from bean of type pagecode.File1: javax.faces.FacesException: Assertion Failed
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:638)
         at com.ibm._jsp._File1._jspService(_File1.java:92)
         at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
    Any kind of help on this issue would be appreciated,
    Thanks in advance,
    Raina

    Hi,
    I solved my problem just by replacing UIOutput component with HtmlOutputText component and then making it as a child component of UICommand component.
    Now I am facing a new problem. Whenever I try to refresh the page I get following exception
    "SRVE0026E: [Servlet Error]-[Faces Servlet]: java.lang.IllegalStateException: Duplicate component ID 'form1:table1:cmd0' found in view."
    I am explicitly setting the component id of the UICommand component using the setViewId() method.
    This problem is observed only when I refresh the page. In case I navigate to another page and then again come back to this current page, then I don't get this exception.
    Your help would be appreciated,
    Raina

  • Af:tree with command link

    hi experts,
    am using jdeveloper 11g version 11.1.1.5.0 - adfbc components - oracle db 10g.
    am trying some examples regards,
    af:tree with commandLink,
    here what i did:
    i achieved the af:tree with the help of some association between two tables and then i exposed in ui,
    you can see in this pics1 :
    http://www.4shared.com/photo/kGE2M1yl/pics1.html
    and then af:tree output can also seen in pics2:
    http://www.4shared.com/photo/GQTB9icb/pic2.html
    this is the code for af:tree
    <af:tree value="#{bindings.ApplBusFunSuiteView1.treeModel}"
                         var="node"
                         selectionListener="#{bindings.ApplBusFunSuiteView1.treeModel.makeCurrent}"
                         rowSelection="single" binding="#{backing_untitled1.t1}"
                         id="t1">
                  <f:facet name="nodeStamp">
                     <af:outputText value="#{node}"
                                     binding="#{backing_untitled1.ot1}" id="ot1"/>
                  </f:facet>
                </af:tree>ok thing which i did all are ok.
    but my need is :
    you may see in pics2.
    http://www.4shared.com/photo/GQTB9icb/pic2.html
    i make red mark on the on a child.
    here am going to explain my need
    in the picture you can see CRM as parent
    MKG as first child
    MKG3200 as last child.
    command link should be appeared.
    when i click that it will navigate to the corresponding page.
    for eg: if i click MKG3200 navigate to the MKG3200 page.
    how can i do this.? i need some guidance.
    sorry for my poor english.
    Edited by: Erp on Dec 1, 2011 4:34 AM

    hi am waiting for john
    retrieves the page IDhere the author get the node id.
    in my task n get the page id and navigate to it. as you said.
    http://andrejusb.blogspot.com/search/label/Tree
    thanks to andrejus and you(john)
    package view.backing;
    import java.util.Iterator;
    import java.util.List;
    import javax.el.ELContext;
    import javax.el.ExpressionFactory;
    import javax.el.MethodExpression;
    import javax.faces.application.Application;
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;
    import oracle.adf.controller.TaskFlowId;
    import oracle.adf.view.rich.component.rich.RichDocument;
    import oracle.adf.view.rich.component.rich.RichForm;
    import oracle.adf.view.rich.component.rich.data.RichTree;
    import oracle.adf.view.rich.component.rich.fragment.RichRegion;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    import oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout;
    import oracle.adf.view.rich.component.rich.layout.RichPanelSplitter;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    import oracle.adf.view.rich.component.rich.nav.RichCommandLink;
    import oracle.adf.view.rich.component.rich.output.RichMessages;
    import oracle.jbo.Row;
    import oracle.jbo.uicli.binding.JUCtrlHierBinding;
    import oracle.jbo.uicli.binding.JUCtrlHierNodeBinding;
    import org.apache.myfaces.trinidad.component.UIXGroup;
    import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
    import org.apache.myfaces.trinidad.event.SelectionEvent;
    import org.apache.myfaces.trinidad.model.CollectionModel;
    import org.apache.myfaces.trinidad.model.RowKeySet;
    import org.apache.myfaces.trinidad.model.TreeModel;
    public class Main1 {
        private RichForm f1;
        private RichDocument d1;
        private RichTree t1;
        private RichMessages m1;
        private RichCommandLink ot1;
        private String taskFlowId = "/WEB-INF/dummy-task-flow-definition.xml#dummy-task-flow-definition";
        private RichRegion r1;
        private UIXGroup g1;
        private RichCommandLink cl1;
        private RichPanelSplitter ps1;
        private RichPanelGroupLayout pgl1;
        private RichInputText it1;
        private RichCommandButton cb1;
        private String i1;
        public void setF1(RichForm f1) {
            this.f1 = f1;
        public RichForm getF1() {
            return f1;
        public void setD1(RichDocument d1) {
            this.d1 = d1;
        public RichDocument getD1() {
            return d1;
        public void setT1(RichTree t1) {
            this.t1 = t1;
        public RichTree getT1() {
            return t1;
        public void setM1(RichMessages m1) {
            this.m1 = m1;
        public RichMessages getM1() {
            return m1;
        public void setOt1(RichCommandLink ot1) {
            this.ot1 = ot1;
        public RichCommandLink getOt1() {
            return ot1;
        public TaskFlowId getDynamicTaskFlowId() {
            return TaskFlowId.parse(taskFlowId);
        public void setR1(RichRegion r1) {
            this.r1 = r1;
        public RichRegion getR1() {
            return r1;
        public String dynaminflow()
             taskFlowId = "/WEB-INF/supplier-task-flow-definition.xml#supplier-task-flow-definition";
              return null;
        public String mainflow1()
                taskFlowId = "/WEB-INF/dummy-task-flow-definition.xml#dummy-task-flow-definition";
              return null;
        public void setG1(UIXGroup g1) {
            this.g1 = g1;
        public UIXGroup getG1() {
            return g1;
        public void setCl1(RichCommandLink cl1) {
            this.cl1 = cl1;
        public RichCommandLink getCl1() {
            return cl1;
        public void setPs1(RichPanelSplitter ps1) {
            this.ps1 = ps1;
        public RichPanelSplitter getPs1() {
            return ps1;
        public void setPgl1(RichPanelGroupLayout pgl1) {
            this.pgl1 = pgl1;
        public RichPanelGroupLayout getPgl1() {
            return pgl1;
        public void setIt1(RichInputText it1) {
            this.it1 = it1;
        public RichInputText getIt1() {
            return it1;
        public void setCb1(RichCommandButton cb1) {
            this.cb1 = cb1;
        public RichCommandButton getCb1() {
            return cb1;
        public void setI1(String i1) {
            this.i1 = i1;
        public String getI1() {
            return i1;
        public String cb1_action() {
            // Add event code here...
          if(this.getI1().equalsIgnoreCase("SUP1000")  ) {
                         dynaminflow();
          else  if(this.getI1().equalsIgnoreCase("MAIN1000")  ) {
                               mainflow1();
          else{
                    FacesContext ctx = FacesContext.getCurrentInstance();
                    FacesMessage fm =
                        new FacesMessage(FacesMessage.SEVERITY_ERROR, "Page Not found",
                    ctx.addMessage(null, fm);
                    return null;
            return null;
        public void onTreeSelect(SelectionEvent selectionEvent) {
         /*   //original selection listener set by ADF
            //#{bindings.allDepartments.treeModel.makeCurrent}
            String adfSelectionListener = "#{bindings.ApplBusFunSuiteView2.treeModel.makeCurrent}";
            //make sure the default selection listener functionality is preserved.
            //you don't need to do this for multi select trees as the ADF binding
            //only supports single current row selection
            /* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
           /* FacesContext fctx = FacesContext.getCurrentInstance();
            Application application = fctx.getApplication();
            ELContext elCtx = fctx.getELContext();
            ExpressionFactory exprFactory = application.getExpressionFactory();
            MethodExpression me = null;
            me =  exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class, new Class[] { SelectionEvent.class });
            me.invoke(elCtx, new Object[] { selectionEvent });
            /* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
          //  RichTree tree = (RichTree)selectionEvent.getSource();
          //  TreeModel model = (TreeModel)tree.getValue();
            //get selected nodes
         //   RowKeySet rowKeySet = selectionEvent.getAddedSet();
         //   Iterator rksIterator = rowKeySet.iterator(); */
            //for single select configurations, thi sonly is called once
         /*   while (rksIterator.hasNext())
                List key = (List)rksIterator.next();
                JUCtrlHierBinding treeBinding = null;
                CollectionModel collectionModel = (CollectionModel)tree.getValue();
                treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
                JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
                Row rw = nodeBinding.getRow();
                System.out.println(""+nodeBinding.getRow()); */
                //print first row attribute. Note that in a tree you have to determine the node
                //type if you want to select node attributes by name and not index           
            /*    String rowType = rw.getStructureDef().getDefName();
                System.out.println(""+rw.getStructureDef().getDefName());
                if(rowType.equalsIgnoreCase("SuplrDocHdView")){
                    System.out.println("This row is a department: " + rw.getAttribute("SuphdBu"));
                else if(rowType.equalsIgnoreCase("EmployeesView")){
                 System.out.println("This row is an employee: " + rw.getAttribute("EmployeeId"));
                else{
                    System.out.println("Huh ????");
                // ... do more usefuls stuff here
            RowKeySet selection = this.getT1().getSelectedRowKeys();
            if (selection != null && selection.getSize() > 0) {
                for (Object facesTreeRowKey : selection) {
                    this.getT1().setRowKey(facesTreeRowKey);
                    JUCtrlHierNodeBinding root = (JUCtrlHierNodeBinding) this.getT1().getRowData();
                    JUCtrlHierNodeBinding node = this.getFirstChild(root);
                    while (node != null)
                        System.out.println(node.getRow().getAttribute(0));
                        if(node.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2010") )
                            dynaminflow();
                        else  if(node.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2020")  ) {
                                             mainflow1();
                        //node.getRow().remove();
                        if ( node.getChildren() != null) {    
                            node = this.getFirstChild(node);
                        } else {
                            while (this.getNextSibling(node) == null && node != root)
                                node=node.getParent();
                            if(node != root) {
                                node = this.getNextSibling(node);
                            } else {
                                node = null;
                    System.out.println(root.getRow().getAttribute(0));
                    if(root.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2010")  )
                        dynaminflow();
                    else  if(root.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2020")  ) {
                                         mainflow1();
                    //root.getRow().remove();
        private JUCtrlHierNodeBinding getFirstChild(JUCtrlHierNodeBinding node) {
            if (node.getChildren() != null) {
                return (JUCtrlHierNodeBinding)node.getChildren().get(0);
            return null;
        private JUCtrlHierNodeBinding getNextSibling(JUCtrlHierNodeBinding node) {
            JUCtrlHierNodeBinding parent = node.getParent();
            int index = parent.getChildren().indexOf(node);
            index = ++index;
            if(index < parent.getChildren().size()) {
                return (JUCtrlHierNodeBinding)parent.getChildren().get(index);
            return null;       
    }i get my output. what i need.
    you must check whether am going correct?
    please suggest me.
    sorry : pulling this thread to up.

  • GetConnectionURL returns null in Bluetooth Application

    Hi,
    I am trying to make my first steps with the JSR-82 API on mobile phones
    (Nokia 6680 and Sony Ericsson W800i). I have written a simple program
    (see code below), which is supposed to discover near-by devices, search
    for a given service (UUID) on a chosen (previously discovered) device
    (=server) and then to connect to the server and send a byte (n) to it. The
    server should then in turn send n+1 back. All this should be done using
    RFCOMM.
    The code works fine in the emulator as well as on two Nokia phones and
    on two SE phones. It further works, when using a Nokia phone as the
    server and a SE phone as the client. However, when using a SE as the
    client and a Nokia as the server, the call to getConnectionURL() returns
    null instead of a valid URL that can be used to set up the connection
    (you can find this piece of code in the ClientThread class). Can somebody
    explain me what I am doing wrong?
    Thanks,
    Michael
    P.S.:At first I thought it might be a compatibility problem, but in the
    BluetoothDemo program that comes with WTK2.2 the correct URL ist
    returned by getConnectionURL() (have other problems with this example
    though, when it comes to download images, in particular...).
    import java.io.IOException;
    import java.util.Vector;
    import javax.bluetooth.BluetoothStateException;
    import javax.bluetooth.DataElement;
    import javax.bluetooth.DeviceClass;
    import javax.bluetooth.DiscoveryAgent;
    import javax.bluetooth.DiscoveryListener;
    import javax.bluetooth.LocalDevice;
    import javax.bluetooth.RemoteDevice;
    import javax.bluetooth.ServiceRecord;
    import javax.bluetooth.UUID;
    import javax.microedition.io.StreamConnectionNotifier;
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.AlertType;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.List;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    public class MessageTest2 extends MIDlet
          implements CommandListener, DiscoveryListener {
          private final int START = 0;
          private final int SERVER_IDLE = 1;
          private final int CLIENT_START = 2;
          private final int CLIENT_DEVICES_DISCOVERED = 3;
          private final int CLIENT_SERVICES_DISCOVERED = 4;
          private final String MY_UUID = "F0E0D0C0B0A000908070605040302010";
          private final Command EXIT_CMD = new Command("Exit", Command.EXIT, 1);
          private final Command OK_CMD = new Command("Ok", Command.OK, 1);
          private List startList = new List("Select Type", List.IMPLICIT);
          private List deviceList = null;
          private List serviceList = null;
          private Form mainForm = new Form("Message Test 2");
          private int state;
          private ServerThread serverThread = null;
          private LocalDevice local = null;
          private DiscoveryAgent agent = null;
          StreamConnectionNotifier server = null;
          private Vector devicesFound = null;
          private ServiceRecord[] servicesFound = null;
          public MessageTest2() {
                super();
                mainForm.addCommand(EXIT_CMD);
                mainForm.addCommand(OK_CMD);
                mainForm.setCommandListener(this);
                startList.addCommand(EXIT_CMD);
                startList.addCommand(OK_CMD);
                startList.append("Server", null);
                startList.append("Client", null);
                startList.setCommandListener(this);
          protected void startApp() throws MIDletStateChangeException {
                state = START;
                Display.getDisplay(this).setCurrent(startList);
          protected void pauseApp() {
                // TODO Auto-generated method stub
          protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
                // TODO Auto-generated method stub
          public void commandAction(Command c, Displayable d) {
                if (c == EXIT_CMD) {
                      if (server != null) {
                            try {
                                  server.close();
                            } catch (IOException e) {
                      notifyDestroyed();
                if (c == OK_CMD) {
                      if (state == START) {
                            if (startList.getSelectedIndex() == 0) {
                                  startServer();
                            } else {
                                  startClient();
                      } else if (state == CLIENT_START) {
                            doDeviceDiscovery();
                      } else if (state == CLIENT_DEVICES_DISCOVERED) {
                            doServiceDiscovery();
                      } else if (state == CLIENT_SERVICES_DISCOVERED) {
                            communicate();
          public void deviceDiscovered(RemoteDevice dev, DeviceClass devClass) {
                devicesFound.addElement(dev);
          public void servicesDiscovered(int transID, ServiceRecord[] serviceRecs) {
                servicesFound = serviceRecs;
          public void serviceSearchCompleted(int transID, int respCode) {
                switch(respCode) {
                case DiscoveryListener.SERVICE_SEARCH_COMPLETED:
                      showServices();
                      break;
                case DiscoveryListener.SERVICE_SEARCH_DEVICE_NOT_REACHABLE:
                      System.err.println("Device not reachable");
                      break;
                case DiscoveryListener.SERVICE_SEARCH_ERROR:
                      System.err.println("Service search error");
                      break;
                case DiscoveryListener.SERVICE_SEARCH_NO_RECORDS:
                      System.err.println("No records");
                      break;
                case DiscoveryListener.SERVICE_SEARCH_TERMINATED:
                      System.err.println("Service search terminated (cancelled)");
                      break;
          public void inquiryCompleted(int param) {
                switch (param) {
                case DiscoveryListener.INQUIRY_COMPLETED:
                      showDevices();
                      break;
                case DiscoveryListener.INQUIRY_ERROR:
                      System.err.println("Inquiry error");
                      Display.getDisplay(this).setCurrent(mainForm);
                      break;
                case DiscoveryListener.INQUIRY_TERMINATED:
                      System.err.println("Inquiry terminated (cancelled)");
                      Display.getDisplay(this).setCurrent(mainForm);
                      break;
          public void setServer(StreamConnectionNotifier server) {
                this.server = server;
          private void startServer() {
                state = SERVER_IDLE;
                mainForm.deleteAll();
                mainForm.append("Server");
                Display.getDisplay(this).setCurrent(mainForm);
                String connectionURL = "btspp://localhost:" + MY_UUID + ";"
                      + "authenticate=false;encrypt=false;name=RFCOMM Server";
                try {
                      local = LocalDevice.getLocalDevice();
                      local.setDiscoverable(DiscoveryAgent.GIAC);
                } catch (BluetoothStateException e) {
                      System.err.println(e);
                serverThread = new ServerThread(this, connectionURL);
                serverThread.start();
                System.out.println("Server thread started");
          private void startClient() {
                state = CLIENT_START;
                mainForm.deleteAll();
                mainForm.append("Discover?");
                Display.getDisplay(this).setCurrent(mainForm);
          private void doDeviceDiscovery() {
                Form discoveringForm = new Form("discovering");
                try {
                      local = LocalDevice.getLocalDevice();
                } catch (BluetoothStateException e) {
                      System.err.println(e);
                agent = local.getDiscoveryAgent();
                devicesFound = new Vector();
                try {
                      if (!agent.startInquiry(DiscoveryAgent.GIAC, this)) {
                            System.err.println("Inquiry not started...");
                } catch (BluetoothStateException e) {
                      System.err.println(e);
                Display.getDisplay(this).setCurrent(discoveringForm);
          private void doServiceDiscovery() {
                if (devicesFound.size() <= 0) return;
                int[] attributes = {0x100, 0x101, 0x102};
                UUID[] uuids = new UUID[1];
                uuids[0] = new UUID(MY_UUID, false);
                int index = deviceList.getSelectedIndex();
                RemoteDevice rd = (RemoteDevice)devicesFound.elementAt(index);
                try {
                      agent.searchServices(attributes, uuids, rd, this);
                } catch (BluetoothStateException e) {
                      System.err.println(e);
          private void showDevices() {
                state = CLIENT_DEVICES_DISCOVERED;
                deviceList = new List("Discovered Devices", List.IMPLICIT);
                deviceList.addCommand(EXIT_CMD);
                deviceList.addCommand(OK_CMD);
                deviceList.setCommandListener(this);
                for (int i = 0; i < devicesFound.size(); i++) {
                      RemoteDevice rd = (RemoteDevice)devicesFound.elementAt(i);
                      String str = rd.getBluetoothAddress();
                      try {
                            str = str + " " + rd.getFriendlyName(false);
                      } catch (IOException e) {
                      deviceList.append(str, null);
                Display.getDisplay(this).setCurrent(deviceList);
          private void showServices() {
                state = CLIENT_SERVICES_DISCOVERED;
                if (servicesFound.length <= 0) {
                      mainForm.deleteAll();
                      mainForm.append("no services found");
                      mainForm.append("discover devices?");
                      state = CLIENT_START;
                      Display.getDisplay(this).setCurrent(mainForm);
                      return;
                serviceList = new List("Services Found", List.IMPLICIT);
                serviceList.addCommand(EXIT_CMD);
                serviceList.addCommand(OK_CMD);
                serviceList.setCommandListener(this);
                for (int i = 0; i < servicesFound.length; i++) {
                      String str;
                      ServiceRecord sr = (ServiceRecord)servicesFound;
    DataElement de = sr.getAttributeValue(0x100);
    str = (String)de.getValue();
    serviceList.append(str, null);
    Display.getDisplay(this).setCurrent(serviceList);
    private void communicate() {
    int index = serviceList.getSelectedIndex();
    ServiceRecord sr = (ServiceRecord)servicesFound[index];
    ClientThread clientThread = new ClientThread(this, sr);
    clientThread.start();
    public void showResult(int n) {
    Form resultForm = new Form("End");
    resultForm.addCommand(EXIT_CMD);
    resultForm.setCommandListener(this);
    resultForm.append("Received: " + n);
    Display.getDisplay(this).setCurrent(resultForm);
    public void showMessage(String msg) {
    Displayable d = Display.getDisplay(this).getCurrent();
    Alert al = new Alert("Info", msg, null, AlertType.INFO);
    al.setTimeout(Alert.FOREVER);
    Display.getDisplay(this).setCurrent(al, d);
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.io.StreamConnectionNotifier;
    public class ServerThread extends Thread {
          private MessageTest2 parent;
          private StreamConnectionNotifier server;
          private String connectionURL = null;
          public ServerThread(MessageTest2 parent, String connectionURL) {
                this.parent = parent;
                this.connectionURL = connectionURL;
          public void run() {
                StreamConnection conn = null;
                try {
                      server = (StreamConnectionNotifier) Connector.open(connectionURL);
                } catch (IOException e) {
                      System.err.println(e);
                parent.setServer(server);
                try {
                      conn = server.acceptAndOpen();
                } catch (IOException e) {
                      System.err.println(e);
                InputStream in = null;
                int n = -1;
                try {
                      in = conn.openInputStream();
                      n = in.read();
                } catch (IOException e) {
                      System.err.println(e);
                if (in != null) {
                      try {
                            in.close();
                      } catch (IOException e) {
                            System.err.println(e);
                try {
                      OutputStream out;
                      out = conn.openOutputStream();
                      out.write(n + 1);
                      out.flush();
                } catch (IOException e) {
                      System.err.println(e);
                try {
                      conn.close();
                } catch (IOException e) {
                      System.out.println(e);
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.bluetooth.ServiceRecord;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    public class ClientThread extends Thread {
          private MessageTest2 parent;
          private ServiceRecord sr;
          public ClientThread(MessageTest2 parent, ServiceRecord sr) {
                this.parent = parent;
                this.sr = sr;
          public void run() {
            StreamConnection conn = null;
            String url = null;
            int n = 0;
            try {
                url = sr.getConnectionURL(
                        ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
                if (url == null) {
                      parent.showMessage("URL null");
                      return;
                conn = (StreamConnection) Connector.open(url);
            } catch (IOException e) {
                System.err.println("Note: can't connect to: " + url);
            try {
                OutputStream out = conn.openOutputStream();
                out.write(n);
                out.flush();
                out.close();
                InputStream in = conn.openInputStream();
                n = in.read();
            } catch (IOException e) {
                System.err.println("Can't write to server for: " + url);
            try {
                  conn.close();
            } catch (IOException ee) {
                  System.err.println(ee);
            parent.showResult(n);

    Hi:
    How did you compile and build the package using WSDL2JAVA. I tried under UCM 6.1 environment but receiving error message on 2 of the classes that, too large object.
    axisbuild:
    compiling 1007 source files
    /generatedaxisclient/com/cisco/www/AXLAPLService/AXLAPIBindingStub.java:4026:code too large
    public AXLAPIBindingStub(javax.xml.rpc.Service service)throws org.apache.axis.AxisFault {
    Error
    /generatedaxisclient/com/cisco/www/AXLAPLService/AXLAPIBindingStub.java:18:code too large
    public AXLAPIBindingStub(javax.xml.rpc.Service service)throws org.apache.axis.AxisFault {
    static {
    Error
    2 Errors
    Please let me know if you have any thoughts on this.
    Thank You
    Ramesh Vasudevan

  • Command Link in the af:table Component can not Work in the Request Scope

    Actually, the problem is that when we click on the command link, the action method #{overview.goToLinkAction} is not triggered.
    Here is the codes of action method "goToLinkAction" on the backing bean:
    public String goToLinkAction() {
    String linkString = (String) AdfFacesContext.getCurrentInstance()
    .getProcessScope().get("linkString");
    System.out.println("Link String is: " + linkString);
    return "";
    The data object list "listOfTransefer" for af:table is composed first time when the page is initialized.
    public void onPageLoad() {
    this.listOfTransfers = composeListOfTransfers();
    But when the commandlink or commandbutton is clicked to pose the form, this onPageLoad method is ignored by using PagePhaseListener:
    public void beforePhase(PagePhaseEvent event) {
    FacesPageLifecycleContext ctx =
    (FacesPageLifecycleContext)event.getLifecycleContext();
    if (event.getPhaseId() == Lifecycle.PREPARE_MODEL_ID && needReload()) {
    bc = ctx.getBindingContainer();
    onPageLoad();
    bc = null;
    public final boolean needReload() {
    if (!isPostback())
    return Boolean.TRUE;
    else
    return alwaysReload();
    protected boolean isPostback() {
    return Boolean.TRUE.equals(resolveExpression("#{adfFacesContext.postback}"));
    That means the method "onPageLoad()" may not be invoked when the commandlink is clicked.
    Is there any way to resolve this problem without changing the scope of the backing bean to "session"?
    Your response will be very helpful for us.
    Thanks

    Hi,
    if you implicitly say that this works if the managed bean is in session scope then the problems seems to me that one of your evaluation criterias is reset in the request scope, which I think most likely is the needReload() method. Did you add debug statements to the methods to see where exactly it gets stuck?
    Frank

  • Command Link inside of datatable

    I have the following problem when I put a command link inside a datatable.
    The action or actionlisteners never get called. Now here is the funny thing.
    1. If I move the action link outside the datatable it works.
    2. if I change the scope of the bean to session it works
    3. if the datatable contains more than 1 row it works
    The last one tells me this is a bug.
    To test this I change the sql query to limit the result so 1 row would be returned.
    The sql query returns a CachedRowSetImpl
    I believe this is a bug.
    <h:dataTable rows="6" first="0" id="table" binding="#{event.eventdata}" value="#{event.eventdetails}" var="eventdetail">
    <h:column>
    <h:commandLink value="#{eventdetail.title}" action="#{event.resaveEventaction}" actionListener="#{event.resaveEventdetails}" id="test" >
    </h:commandLink>     
    </h:column>
    <h:column>
    </h:dataTable>

    Here is some additional information that makes this more confusing.
    The following code is used to populate the datatable
    public CachedRowSetImpl getEventdetails(){
         CachedRowSetImpl rs2 = null;
         String selectedeventmy = selectedevent;
         int rowcount = 0;
         try { 
              sql = "SELECT * FROM event where eventid='"+selectedeventmy+"' ";
              rs2 = RunQuery.mysql(sql);
              rowcount = rs2.size();
         } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         return rs2;
    where RunQuery.mysql is
    public class RunQuery {
         public static CachedRowSetImpl mysql(String sql) throws Exception {
              CachedRowSetImpl crset = null;
              InitialContext initCtx = new InitialContext();
              Context envCtx = (Context) initCtx.lookup("java:comp/env");
              try {
                   DataSource ds = (DataSource) envCtx.lookup("jdbc/associations");
                   Connection conn = null;
         Statement stmt = null;
         conn = ds.getConnection();
         stmt = conn.createStatement();
         stmt.execute(sql);
         ResultSet rs = stmt.getResultSet();
         crset = new CachedRowSetImpl();
         crset.populate(rs);
         rs.close();
         stmt.close();
         conn.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
              return crset;
    if I replace the line
    String selectedeventmy = selectedevent;
    with String selectedeventmy = "61";
    it works properly.
    selectedevent is populated from the following triggered by another action event on another page. ? The funny thing is if the result set returns more that 1 row all works ok.
    public String viewDetails(){
         System.out.println("Running view Details");
         int selectedrow = eventlist.getRowIndex();
         Object selected = eventlist.getRowData();
         Map rowdata = (Map) selected;
         selectedevent = rowdata.get("eventid").toString();
         System.out.println("Selected Event:"+selectedevent);
         outcome="eventdetails";
         return outcome;
    }

  • My command link doesn't work

    hi all,
    i have a created a page where i am performing a web type search with search form and search results on the same page and i have also implemented the conditional display of search results table as directed by the ADFBC guide.
    i.e., I created a managed bean where in am setting the searchFirstTime flag. here is the code of my managed bean.
    public class UserState {
    private static final String SEARCH_FIRSTTIME_FLAG = "SEARCH_FIRSTTIME_FLAG";
    private HashMap hmUserSettings = new HashMap();
    public UserState() {
    try{
    System.out.println("setting the user settings in constructor");
    hmUserSettings.put(SEARCH_FIRSTTIME_FLAG,true);
    }catch(Exception e){
    e.printStackTrace();
    public boolean isSearchFirstTime(){
    Boolean firstTime = (Boolean)hmUserSettings.get(SEARCH_FIRSTTIME_FLAG);
    try{
    System.out.println("setting the search flag in isSearchFirstTime firstTime.booleanValue() :"+firstTime.booleanValue());
    if (firstTime == null){
    firstTime = true;
    }catch(Exception e){
    e.printStackTrace();
    return firstTime.booleanValue();
    public void setSearchFirstTime(boolean searchFlag){
    try{
    System.out.println("setting the search flag searchFlag :"+searchFlag);
    hmUserSettings.put(SEARCH_FIRSTTIME_FLAG, new Boolean(searchFlag));
    }catch(Exception e){
    e.printStackTrace();
    In the search results table one of the columns is a command link, clicking on which opens a pop up window where i have some more details being displayed.
    here is the code of my jspx page for the command link
    <af:commandLink text="#{row.OrderNumber}"
    binding="#{backing_TestDDPUD.commandLink1}"
    action="#{backing_TestDDPUD.commandLink1_action}"
    useWindow="true"
    partialSubmit="true"
    windowHeight="200"
    windowWidth="500"
    id="commandLink1"/>
    i have specified the action to be performed,in the backing bean of my page, here's the code
    public String commandLink1_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("setCurrentRowWithKey");
    Object result = operationBinding.execute();
    System.out.println("inside commandLink1_action");
    if (!operationBinding.getErrors().isEmpty()) {
    System.out.println("$$$$$$$$$$$$$$$ has errors $$$$$$$$$$$$4");
    return null;
    DCIteratorBinding ib = (DCIteratorBinding)bindings.get("OeOrderHeadersViewResultsIterator");
    Row row = ib.getCurrentRow();
    Number numHeaderId = (Number)row.getAttribute("HeaderId");
    FacesContext fc = FacesContext.getCurrentInstance();
    // 2. Create value binding for the #{data} EL expression
    ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
    // 3. Evaluate the value binding, casting the result to BindingContext
    BindingContext bc = (BindingContext)vb.getValue(fc);
    // 4. Find the data control by name from the binding context
    DCDataControl dc = bc.findDataControl("TestDDAppModuleDataControl");
    // 5. Access the application module data provider
    ApplicationModule am = (ApplicationModule)dc.getDataProvider();
    ViewObject vo = am.findViewObject("OeOrderLinesAllView");
    vo.setNamedWhereClauseParam("theHeaderId",numHeaderId);
    System.out.println((vo.getNamedWhereClauseParam("theHeaderId")));
    return "dialog:orderDetails";
    my problem is that now when i enter a search criteria and execute the search, the search results are displayed properly in the table but when i click on the command link it does not open the pop up window, it does not even enter into the commandlink1_action() method..here's the log which i get after i click on the command link..can somebody please tell me what is going wrong or what exactly is happening
    07/03/28 17:19:20 [363] Reusing a cached session application module instance
    07/03/28 17:21:03 [364] **** refreshControl() for BindingContainer :TestDDPUDPageDef
    07/03/28 17:21:03 [365] *** Using bean introspection to lookup value :result
    07/03/28 17:21:03 [366] Invoke method Action:999
    07/03/28 17:21:03 [367] DCInvokeMethod:Invoking TestDDAppModuleDataControl.dataProvider.setOrgPolicyContext()
    07/03/28 17:21:03 inside the setOrgPolicyContext
    07/03/28 17:21:03 blnSetOrgPolicyContext finally :true
    07/03/28 17:21:03 [368] Resolving VO:TestDDAppModule.OeOrderHeadersView for iterator binding:OeOrderHeadersViewIterator
    07/03/28 17:21:03 [369] DCUtil, RETURNING: <null> for TestDDAppModule.OeOrderHeadersView
    07/03/28 17:21:03 [370] Resolving VO:OeOrderHeadersView for iterator binding:OeOrderHeadersViewResultsIterator
    07/03/28 17:21:03 [371] DCUtil, returning:oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding, for OeOrderHeadersView
    07/03/28 17:21:03 [372] *** DCDataControl.sync() called from :DCBindingContainer.refresh
    07/03/28 17:21:03 [373] valiateToken:Decompressed BC state:BCST:=0OeOrderHeadersViewIterator=-F-,OeOrderHeadersViewResultsIterator=-D-000100000004C30A031F,
    07/03/28 17:21:03 setting the user settings in constructor
    07/03/28 17:21:03 setting the search flag in isSearchFirstTime firstTime.booleanValue() :true
    07/03/28 17:21:03 setting the search flag in isSearchFirstTime firstTime.booleanValue() :true
    07/03/28 17:21:03 setting the search flag in isSearchFirstTime firstTime.booleanValue() :true
    07/03/28 17:21:03 [374] **** refreshControl() for BindingContainer :TestDDPUDPageDef
    07/03/28 17:21:03 [375] *** DCDataControl.sync() called from :DCBindingContainer.refresh
    07/03/28 17:21:03 setting the search flag in isSearchFirstTime firstTime.booleanValue() :true

    hi Frank,
    i have my table inside a panel page which is already sorrounded with h:form so i cannot sorround my table again with h:form or af:form. the command link in the page was working fine, till i included the code for the conditional display of the results table. If i look at the log printed after i click on the command link, i don't see any of the sop's being printed that i have given inside the commandlink1_action() method, i have a feeling that my action method is not being called at all and i am not able to figure out why the sop in the isSearchFirstTime() method is being printed 4 times.
    here is the entire code of my .jspx
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <afh:html binding="#{backing_TestDDPUD.html1}" id="html1">
    <f:loadBundle basename="UIResources" var="res"/>
    <afh:head title="SalesOrderTemplate" binding="#{backing_TestDDPUD.head1}"
    id="head1">
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    </afh:head>
    <afh:body binding="#{backing_TestDDPUD.body1}" id="body1">
    <af:messages binding="#{backing_TestDDPUD.messages1}" id="messages1"/>
    <h:form binding="#{backing_TestDDPUD.form1}" id="form1">
    <af:panelPage title="Change Me"
    binding="#{backing_TestDDPUD.panelPage1}"
    id="panelPage1">
    <f:facet name="menu1"/>
    <f:facet name="menuGlobal"/>
    <f:facet name="branding"/>
    <f:facet name="brandingApp"/>
    <f:facet name="appCopyright"/>
    <f:facet name="appPrivacy"/>
    <f:facet name="appAbout"/>
    <af:panelForm binding="#{backing_TestDDPUD.panelForm1}"
    id="panelForm1">
    <af:inputText value="#{bindings.OrderNumber.inputValue}"
    label="#{bindings.OrderNumber.label}"
    columns="#{bindings.OrderNumber.displayWidth}"
    binding="#{backing_TestDDPUD.inputText8}"
    id="inputText8"/>
    <af:inputText value="#{bindings.SoldToOrgId.inputValue}"
    label="#{bindings.SoldToOrgId.label}"
    columns="#{bindings.SoldToOrgId.displayWidth}"
    binding="#{backing_TestDDPUD.inputText39}"
    id="inputText39"/>
    <f:facet name="footer">
    <af:panelGroup layout="vertical"
    binding="#{backing_TestDDPUD.panelGroup1}"
    id="panelGroup1">
    <af:panelButtonBar binding="#{backing_TestDDPUD.panelButtonBar2}"
    id="panelButtonBar2">
    <af:commandButton actionListener="#{bindings.Execute.execute}"
    text="Search"
    disabled="#{!bindings.Execute.enabled}"
    binding="#{backing_TestDDPUD.commandButton2}"
    id="commandButton2">
    <af:setActionListener from="#{false}"
    to="#{UserState.searchFirstTime}"/>
    </af:commandButton>
    </af:panelButtonBar>
    </af:panelGroup>
    </f:facet>
    </af:panelForm>
    <af:table value="#{bindings.OeOrderHeadersView.collectionModel}"
    var="row"
    rows="#{bindings.OeOrderHeadersView.rangeSize}"
    first="#{bindings.OeOrderHeadersView.rangeStart}"
    emptyText="#{bindings.OeOrderHeadersView.viewable ? 'No rows yet.' : 'Access Denied.'}"
    binding="#{backing_TestDDPUD.table1}" id="table1"
    rendered="#{UserState.searchFirstTime == false}">
    <af:column sortProperty="OrderNumber" sortable="false"
    headerText="#{bindings.OeOrderHeadersView.labels.OrderNumber}"
    binding="#{backing_TestDDPUD.column1}" id="column1">
    <af:commandLink text="#{row.OrderNumber}"
    binding="#{backing_TestDDPUD.commandLink1}"
    action="#{backing_TestDDPUD.commandLink1_action}"
    useWindow="true" partialSubmit="true"
    windowHeight="200" windowWidth="500"
    id="commandLink1"/>
    </af:column>
    <af:column sortProperty="SoldToOrgId" sortable="false"
    headerText="#{bindings.OeOrderHeadersView.labels.SoldToOrgId}"
    binding="#{backing_TestDDPUD.column2}" id="column2">
    <af:inputText value="#{row.SoldToOrgId}"
    required="#{bindings.OeOrderHeadersView.attrDefs.SoldToOrgId.mandatory}"
    columns="#{bindings.OeOrderHeadersView.attrHints.SoldToOrgId.displayWidth}"
    binding="#{backing_TestDDPUD.inputText2}"
    id="inputText2">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.OeOrderHeadersView.formats.SoldToOrgId}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="OrderTypeId" sortable="false"
    headerText="#{bindings.OeOrderHeadersView.labels.OrderTypeId}"
    binding="#{backing_TestDDPUD.column3}" id="column3">
    <af:inputText value="#{row.OrderTypeId}"
    required="#{bindings.OeOrderHeadersView.attrDefs.OrderTypeId.mandatory}"
    columns="#{bindings.OeOrderHeadersView.attrHints.OrderTypeId.displayWidth}"
    binding="#{backing_TestDDPUD.inputText3}"
    id="inputText3">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.OeOrderHeadersView.formats.OrderTypeId}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="RequestDate" sortable="false"
    headerText="#{bindings.OeOrderHeadersView.labels.RequestDate}"
    binding="#{backing_TestDDPUD.column4}" id="column4">
    <af:inputText value="#{row.RequestDate}"
    required="#{bindings.OeOrderHeadersView.attrDefs.RequestDate.mandatory}"
    columns="#{bindings.OeOrderHeadersView.attrHints.RequestDate.displayWidth}"
    binding="#{backing_TestDDPUD.inputText5}"
    id="inputText5">
    <f:convertDateTime pattern="#{bindings.OeOrderHeadersView.formats.RequestDate}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="OrderedDate" sortable="false"
    headerText="#{bindings.OeOrderHeadersView.labels.OrderedDate}"
    binding="#{backing_TestDDPUD.column5}" id="column5">
    <af:inputText value="#{row.OrderedDate}"
    required="#{bindings.OeOrderHeadersView.attrDefs.OrderedDate.mandatory}"
    columns="#{bindings.OeOrderHeadersView.attrHints.OrderedDate.displayWidth}"
    binding="#{backing_TestDDPUD.inputText6}"
    id="inputText6">
    <f:convertDateTime pattern="#{bindings.OeOrderHeadersView.formats.OrderedDate}"/>
    </af:inputText>
    </af:column>
    </af:table>
    </af:panelPage>
    </h:form>
    </afh:body>
    </afh:html>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_TestDDPUD-->
    </jsp:root>
    thanks,
    lavanya

  • Command: Link to KM folder - does it exsist/workaround

    Hi,
    We have a KM folder where we store articles based on xml forms.  One iView displays the last 3 articles from this folder.
    Is there a command that can be used in the collection renderer for creating a link to this KM folder and display the content with a selected layout set?  The goal is that the user should be able to view all the articles in the folder.  Is there maybe another work around?  Any pointers?
    Best,
    Bjorn

    Hi Bjorn,
    I had the same requirement and this is the code that i used...
    I got this from SDN only from Thilo's How to Guide...
    I tried to find that link...
    package com.company;
    import java.io.InputStream;
    import java.util.List;
    import java.util.Properties;
    import com.sap.tc.logging.Location;
    import com.sapportals.portal.security.usermanagement.IUser;
    import com.sapportals.wcm.WcmException;
    import com.sapportals.wcm.rendering.base.IRenderingEvent;
    import com.sapportals.wcm.rendering.base.IScreenflowData;
    import com.sapportals.wcm.rendering.uicommand.AbstractCommand;
    import com.sapportals.wcm.rendering.uicommand.ICommand;
    import com.sapportals.wcm.rendering.uicommand.LinkAttributes;
    import com.sapportals.wcm.repository.IResource;
    import com.sapportals.wcm.repository.IResourceContext;
    import com.sapportals.wcm.repository.ResourceContext;
    import com.sapportals.wcm.repository.ResourceException;
    import com.sapportals.wcm.repository.ResourceFactory;
    import com.sapportals.wcm.service.IServiceTypesConst;
    import com.sapportals.wcm.service.urlgenerator.IURLGeneratorService;
    import com.sapportals.wcm.service.urlgenerator.PathKey;
    import com.sapportals.wcm.util.content.IContent;
    import com.sapportals.wcm.util.uri.IHierarchicalUri;
    import com.sapportals.wcm.util.uri.IUriReference;
    import com.sapportals.wcm.util.uri.RID;
    import com.sapportals.wcm.util.usermanagement.WPUMFactory;
    public class Revisions extends AbstractCommand {
         Location logger = Location.getLocation(Revisions.class);
         //String url = "";
         //private List values;
         public Revisions() {
              super("Revisions", "Revisions");
         public ICommand getNewInstance() {
              return this.initNewInstance(new Revisions());
         public IRenderingEvent execute(IScreenflowData arg0) throws WcmException {
              return null;
         public String[] getTargetParameters() throws WcmException {
              //return new String[0];
              String result[] = new String[1];
              result[0] = this.resource.getRID().getPath();
              return result;
         public void setTargetParameters(List arg0, IResourceContext arg1)
              throws WcmException {
              //          this.context = arg1;
              //          this.values = arg0;
         public boolean isExecutable() {
              return true;
         protected String getLabel() {
              String label = "Revisions";
              try {
                   label = getproperty("COMMAND_LABEL");
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return label;
         protected String getTooltip() {
              String toolTip = "View all revsions";
              try {
                   toolTip = getproperty("TOOL_TIP");
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return toolTip;
         public boolean raisesEvent() {
              return false;
              //Changed false to true to make the call to EXECUTE method
         public LinkAttributes getLinkAttributes() {
              LinkAttributes linkAttributes = null;
              IResource res = this.getResource();
              String resURL = "";
              try {
                   resURL = urlGeneration(resource.getRID());
              } catch (ResourceException e2) {
                   // TODO Auto-generated catch block
                   e2.printStackTrace();
              resURL =
                   resURL.replaceAll("com.sap.km.cm.docs", "com.sap.km.cm.navigation");
              try {
                   linkAttributes =
                        new LinkAttributes(
                             resURL + "?rndLayoutSet=" + getproperty("rndLayoutSet"),
                             "_blank");
              } catch (Exception e) {
                   //                TODO Auto-generated catch block
                   e.printStackTrace();
              return linkAttributes;
         public java.lang.String urlGeneration(
              com.sapportals.wcm.util.uri.RID rid) {
              //@@begin urlGeneration()
              IURLGeneratorService ug;
              IUriReference uriRef = null;
              String uriString = "";
              try {
                   ug =
                        (IURLGeneratorService) ResourceFactory
                             .getInstance()
                             .getServiceFactory()
                             .getService(IServiceTypesConst.URLGENERATOR_SERVICE);
                   uriRef =
                        ug.getResourcePageUri(PathKey.CONTENT_ACCESS_PATH, rid, null);
                   IHierarchicalUri uri = ug.createAbsoluteUri(uriRef);
                   uriString = uri.toExternalForm();
                   uriString = escapeURLSpace(uriString);
              } catch (ResourceException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (WcmException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (Exception e) {
                   // TODO: handle exception
                   e.printStackTrace();
              return uriString;
              //@@end
         public java.lang.String escapeURLSpace(java.lang.String url) {
              //@@begin escapeURLSpace()
              StringBuffer str = new StringBuffer(50);
              int len = (url != null) ? url.length() : 0;
              for (int i = 0; i < len; i++) {
                   char ch = url.charAt(i);
                   switch (ch) {
                        case ' ' :
                             str.append("%20");
                             break;
                        case '&' :
                             str.append("%26");
                             break;
                        default :
                             str.append(ch);
              return str.toString();
              //@@end
         public String getproperty(String key) throws Exception {
              IUser adminUser =
                   WPUMFactory.getServiceUserFactory().getServiceUser(
                        "cmadmin_service");
              InputStream is = null;
              String value = "";
              String configFilePath =
                   "/documents/command.properties";
              RID ridOfConfigFile = RID.getRID(configFilePath);
              try {
                   if (adminUser.isAuthenticated()) {
                        // create a resource context with the authenticated user
                        ResourceContext resourceContext =
                             new ResourceContext(adminUser);
                        IResource resource =
                             ResourceFactory.getInstance().getResource(
                                  ridOfConfigFile,
                                  resourceContext);
                        IContent iContent = resource.getContent();
                        is = iContent.getInputStream();
                        Properties props = new Properties();
                        props.load(is);
                        value = props.getProperty(key);
              } finally {
                   if (is != null)
                        is.close();
              return value;

  • MDX Query using BottomCount to limit Median calculation returns null

    I'm building a new cube that includes some person age values that aren't useful when summed, but are
    useful when the median is determined. The measure group that contains the measure for the age has a 1-1 relationship with a dimension in the cube because both use the same table as the source. This is important because I use the key attribute of the dimension
    as the set expression in the Median function to prevent any summation before the median is found. Here is the code for the original median calculation:
    MEMBER Measures.[Median Age] AS
    MEDIAN(
    [Placement Dimension].[Id Removal Episode Fact].Members,
    [Measures].[Age At Removal Months]
    This median naturally represents the half-way point in the series of values. My analysts have also requested
    median-type values at the quarter and three-quarter points in the same series. I've been able to accomplish this for the three-quarter point by nesting the TopCount function in the set expression of the Median function to limit the set to the last half of
    the records and then find the median point like this:
    MEMBER Measures.[75th Percentile] AS
    MEDIAN(
    TOPCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    However, my attempt to use the BottomCount function in the same way as TopCount to find the quarter point
    in the whole data set by limiting the calculation's set to the first half of the data always returns null. Here is how I've formed the code:
    MEMBER Measures.[25th Percentile] AS
    MEDIAN(
    BOTTOMCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    And here is the query that returns the values:
    SELECT
    Measures.[Episode Count]
    ,Measures.[Median Age]
    ,Measures.[25th Percentile]
    ,Measures.[75th Percentile]
    } ON 0
    ,[Date Begin].[Calendar Hierarchy].Year.&[2011]:[Date Begin].[Calendar Hierarchy].Year.&[2014] ON 1
    FROM [POC Cube]
    WHERE
    [Age at Removal Mos].[Age in Years List].[Age Year].&[0]:[Age at Removal Mos].[Age in Years List].[Age Year].&[5]
    I don't know why the end result is always null. I don't have any null values in the data for this measure, and I know what values I should be seeing because I've found the median records manually in results from a SQL Server query. I've tried using TopCount
    and multiplying Measures.[Age At Removal Months] in the TopCount function by -1 to workaround the descending sort, but I still get nulls. I've also tried separating these queries out so the quarter point and three-quarter point calculations aren't run together,
    but I still get nulls for the quarter point calculation.
    I'm open to any help fixing this situation by modifying my current code or by using alternate methods, but the end result has to be dynamic enough to be used as a calculation in the cube. Thanks!

    The links might helps.
    http://technet.microsoft.com/en-us/library/ms144864.aspx
    http://www.mssqltips.com/sqlservertip/3034/sql-server-analysis-services-ssas-2012-top-and-bottom-functions/
    http://www.sqlservercentral.com/blogs/bradleyschacht/2012/03/12/mdx-functions-bottomcount/

  • Component binding return null value

    I'm migrating a JSF 1.2 application to JSF 2.1, specificly I'm currently using mojorra 2.1.24.
    The application consists of request scoped beans, and in order to pass data between requests, it embeds the data inside UI components.
    The following behaviour works well with JSF 1.2, but not with JSF 2.1.
    The application has the following configuration:
    <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
    </context-param>
    The page contains the following snippet:
    <h:form prependId="false">
         <h:inputHidden binding="#{bean.inputHidden}" />
         <h:panelGroup rendered="#{bean.rendered}">
          <h:commandLink value="onAction" action="#{bean.onAction}" />
         </h:panelGroup>
    </h:form>
    The bean is the following:
    @ManagedBean
    @RequestScoped
    public class Bean {
      private UIInput inputHidden;
      private AItem item;
      public setInputHidden(UIInput inputHidden){
        this.inputHidden = inputHidden;
        if(item != null){ this.inputHidden.setValue(item); }
      public AItem getItem(){
        return (AItem) getInputHidden().getValue();
      // other getter/setter
      public String onNavToPage(AItem item){ this.item = item; return "page"; }
      public String onAction(){ //... do something return ""; }
      public boolean isRendered(){ return getProcessItem() != null; }
    The steps are the following:
    to navigate to page page the method bean.onNavToPage is invoked from within another page;
    upon page rendering the bean.item is set as bean.inputHidden value;
    after the page is diplayed, the command link is pressed.
    At this point no command link is invoked, because the bean.inputHidden.getValue() returns null, and the command link is not processed.
    I noticed that the inputHidden parameter passed to the setInputHidden method during restore view phase has, inputHidden.getValue() == null, no value has been saved previously in the view.
    I would guess that something has changed in the component state management, but debugging the JSF code I didn't find what.
    Debugging JSF code I found that the component state has been masked before the state has been saved in the view, so the ComponentStateHelper.saveState saves the deltaMap and not the defaultMap, where all the state has been put.
    public Object saveState(FacesContext context) {
            if (context == null) {
                throw new NullPointerException();
            if(component.initialStateMarked()) {
                return saveMap(context, deltaMap);
            else {
                return saveMap(context, defaultMap);
    is this a bug?
    If not, how can I restore JSF 1.2 behaviuor and save the defaultMap?
    Thanks in advance for the help.

    0.10: Saved session state: 6385226710016200 "P327_OU_NAME" changedValue="test"
    0.10: ...P327_FK_ORGUNIT session state saving same value: "%null%"
    0.15: Saved session state: 6388922235040486 "P327_OU_DESC" changedValue=""
    0.15: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.15: Branch point: BEFORE_COMPUTATION
    0.15: Computation point: AFTER_SUBMIT
    0.15: Perform Branching for Tab Requests
    0.15: Branch point: BEFORE_VALIDATION
    0.15: Perform validations:
    0.16: Branch point: BEFORE_PROCESSING
    0.16: Processing point: AFTER_SUBMIT
    0.16: ...PLSQL (AFTER_SUBMIT) INSERT INTO INDIT_PS_ORGUNIT ( OU_ID, FK_ORGUNIT, OU_NAME, OU_DESC ) VALUES ( INDIT_PASS_SEQ_GENERIC_ID.NEXTVAL, :P327_FK_ORGUNIT, :P327_OU_NAME, :P327_OU_DESC )
    0.16: Show ERROR page...
    0.17: Processing point: AFTER_ERROR_HEADER
    0.18: Processing point: BEFORE_ERROR_FOOTER
    ORA-01722: invalid number
    the table was created with:
    CREATE TABLE INDIT_PS_ORGUNIT (
    OU_ID NUMBER(15) PRIMARY KEY,
    FK_ORGUNIT NUMBER(15) NULL,
    OU_NAME VARCHAR2(30) NOT NULL,
    OU_DESC VARCHAR2(30) NULL,
    OU_DELETED DATE NULL
    what i see is that the status is "%null%" and not really "" (NULL, nothing, ...).
    so what can i do to insert a null value from a select list?
    i gave up RTFM. because i found nothing (NULL) ?!?!

  • Resetting the id of dynamically generated JSF custom command link

    I have a java faces page which displays data from an arraylist.
    This list is populated when user inputs data in the input text field and clicks "Add Group" button.
    The arralylist consist of another arraylist within the former.
    I have created a custom command link for the former arraylist.
    As an user can add data to the arraylist so can he remove it from the arraylist.
    The command link has a method binding "closeTask" which is invoked when command link is clicked.
    This action removes the clicked element from the arraylist and displays the fresh list.
    The key field from the bean in the former arraylist is set in request, and is retrieved in the "closeTask" method to be assigned to the command link output text id (i.e. it identifies the element that is to be deleted from the arraylist).
    This functionality does not work as expected, i.e. command link component is not created/rendered during deletion as it is created while addition.
    As a result eventhough the element is removed from the arraylist, the id corresponding to the fresh arraylist is not refreshed and for further actions correct id is not passed and the deletion function does not work.
    How can I have resolve this problem?
    The sample code is included.
    Thanks in advance.
    Java Faces Code:
    <%
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    Bkbean bean = (Bkbean)app.createValueBinding("#{bckbean}").getValue(facesContext);
    List aList = bean.getAList();
    if(aList!=null && aList.size()>0) {                                                            
    for(int i=0; i<aList.size(); i++) {
    ABean abean = (ABean) aList.get(i);
    int keyValue = abean.getKey();
    request.setAttribute("key", String.valueOf(keyValue));
    %>
    <TR>
    <TD width="90%">
    <%=abean.getCtg()%>
    </TD>
    <TD width="9%">
    <%=abean.getKey()%>
    </TD>
    <TD width="1%" align="right" valign="top">
    <h:commandLink binding="#{bckbean.commandLnk}" styleClass="commandLink">
    </h:commandLink>
    </TD>
    </TR>
    <%
    List dList = abean.getDList();
    if(dList!=null) {
    for(int j=0; j<dList.size(); j++) {
    String tData = (String) dList.get(j);
    %>
    <TR>
    <TD width="90%">
    <%=tData%>
    </TD>
    <TD width="10%" colspan="2">
    </TD>
    </TR>
    <%
    }%>
    <%
    %>
    <TR>
    <TD align="right">
    <h:inputText id="inputtxt001" value="#{bckbean.val}"></h:inputText>
    </TD>
    <TD align="left" colspan="2">
    <hx:commandExButton type="submit" value=" Add Group " styleClass="commandExButton" id="submitbtn001" action="#{bckbean.addVal}">
    </hx:commandExButton>
    </TD>
    </TR>
    Backing Bean Code:
    public void closeTask(ActionEvent event) {
    String key = "";
    UIOutput lnkTxt = null;
    UICommand comp = (UICommand)event.getComponent();
    if(comp.getChildren() != null && comp.getChildren().size() >0) {
    for (int i=0; i<comp.getChildren().size(); i++) {
    lnkTxt = (UIOutput)comp.getChildren().get(i);
    key = lnkTxt.getId();
    int selectedKey = (new Integer(key.substring(2))).intValue();
    if(aList!=null) {
    for(int i=0; i<aList.size(); i++) {
    ABean abean = (ABean) aList.get(i);
    if(abean.getKey()==selectedKey) {                                             
    aList.remove(i);
    break;
    public UICommand getCommandLnk() {
    String id = (String) request.getAttribute("key");
    UICommand commandLnk = new UICommand();
    commandLnk.setId("key" + id);
    UIOutput outTxt = new UIOutput();
    outTxt.setId("id"+id);
    outTxt.setValue("X");
    commandLnk.getChildren().add(outTxt);
    MethodBinding mb = app.createMethodBinding("#{bckbean.closeTask}", new Class[]{ActionEvent.class});
    commandLnk.setActionListener(mb);
    commandLnk.setImmediate(true);
    return commandLnk;
    }

    You cud define jsObjectNeeded and onClientClick properties for the htlm component and catch the event to find itz ID.
    This might help you:
    Accessing HTMLB form values from JAVASCRIPT
    To give you an idea abt how the code works:
    Portal: Bug in the  radio button's javascript api
    Regards,
    N.
    Plz click a star if it helped.

Maybe you are looking for