3 Replies Latest reply on Nov 6, 2013 5:46 AM by LargeDachshund

    Localizing the Timestamp as a default value


      i'm trying to add a read-only field to a form that will have a timestamp based on the user's location, i.e. his browser location.  i've seen comments abound on timestamps in the database, but, in this situation, i'm not running a system process.


      i want to record the time when the user created the record.  is it true that adfFacesContext.getCurrentInstance() has a property that indicates the browser's local time.  can i somehow put it in the VO attribute's default value?


      can this be done programmatically?


          BindingContainer bindings = getBindings();



          OperationBinding operationBinding = bindings.getOperationBinding("Create");



          Object result = operationBinding.execute();



          if (!operationBinding.getErrors().isEmpty())


      If i intercept the process prior to operationBinding.execute, can i set the field after i get the local time and convert to timestamp?



        • 1. Re: Localizing the Timestamp as a default value
          Frank Nimphius-Oracle



          you can access the field after you executed the "Create" operation. Before it does not much sense as there would not be a new row created. You can then call


          DcIteratorBinding iter = (DcIteratorBinding) bindings.get("Name of Iterator");

          Row rw = iter.getCurrentRow();

          //set value


          rw.setAttribute("name of attribute", value);


          If this doesn't immediately show on the UI, issue a PPR (ADFFacesContext.getCurrentInstance().addPartialTarget(component) ) for the form layout or table



          For the client timezone, have a look at


          Configuring Apache Trinidad


          It discusses the time-zone option in trinidad-config.xml (used by ADF Faces). You can use this with org.apache.myfaces.trinidad.converter.DateTimeConverter to convert times from a String



          • 2. Re: Localizing the Timestamp as a default value


            thank you so much for your detailed response.  it's Halloween in the States, so i'll provide you a reply on how it goes with your solution over the weekend.

            • 3. Re: Localizing the Timestamp as a default value

              hey Frank,

              i think your hunch was right.  PPR is in order because i wasnt able to get the fields to appear.  now, i've hunted around for a way of invoking the PPR.  on pfl1(panelFormLayout), i set the clientComponent attribute to true.  no joy.  this is what i got:

                public String createNewRow()


                BindingContainer bindings;

                  OperationBinding operationBinding;

                  Object result;

                  DCIteratorBinding iter;

                  Row rw;


                  bindings = getBindings();



                  operationBinding = bindings.getOperationBinding("Create");



                  //create the empty row

                  result = operationBinding.execute();



                  //access the empty row and set the Created field

                  iter = (DCIteratorBinding) bindings.get("JATableView1Iterator");



                  rw = iter.getCurrentRow();



                  //set value: this isnt even a timestamp.  once i can get the form fields to appear, i'll worry about the timestamp!

                  rw.setAttribute("Created", "11/9/2013");




                  if (!operationBinding.getErrors().isEmpty())


                    return null;




                    return null;




                private UIComponent getUIComponent(String name)


                  FacesContext facesCtx = FacesContext.getCurrentInstance(); 

                  return facesCtx.getViewRoot().findComponent(name);