Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    cast object java in smartclient

    PREQUESTION:

    Hi i have an object java

    Object[] unions = XmonUtils.getUnions();

    Union = [
    <% for (int i=0; i<unions.length; i++){ %>
    <% UnionService union = (UnionService)unions[i]; %>

    <% if(union != null){ %>
    {
    Name:"<%=initializer.getBundle().getString(Util.generateKey(union, "name"), union.getName())%>",
    Description:"<%=initializer.getBundle().getString(Util.generateKey(union, "description"), union.getDescription())%>"
    }
    <% if(i != (unions.length -1)){ %>
    ,
    <% } %>

    <% } %>

    <% } %>
    ]


    after in a put in a ListGrid the object in this mode
    XmonList.setData(Services);

    ALL WORK SO.

    QUESTION :

    I call via dmi with DMI.call
    with yours examples all works.

    Now i have called the object up
    in the .java but how i can manage it after in jsp???

    .java
    ------------------------------------------------------------
    public class ClasseAjax {

    public Object[] MetodoAjax () {


    Object[] unions = XmonUtils.getUnions();

    // send back our own time as the response
    return unions();
    }


    }
    ------------------------------------------------------------------------

    after in client :

    DMI.call("example", "ClasseAjax", "MetodoAjax", "prova", "myfunction(data)");


    function myfunction(data)
    {
    alert(data.length); < --- // an example it work and the lenght arrive and is printed so the object is viewed

    HERE HOW I CAN DO A FOR WITH THE OBJECT JAVA OF UP, IF NOW I HAVE A OBJECT DATA JAVASCRIPT??????


    }

    #2
    Hi lupin,

    Could you elaborate on this part of your question:

    HERE HOW I CAN DO A FOR WITH THE OBJECT JAVA OF UP, IF NOW I HAVE A OBJECT DATA JAVASCRIPT??????

    Comment


      #3
      dmi.call

      The Dmi.call return a object "data".

      If is a string in the .java, after the return in my .jsp, i can put it in a label or a button and i can manipulate it ,
      as the example of new Date of smartClient.


      But if is a object java in the .java, how i can cast and work with it on my .jsp, for example do a "for" on it and call more getName() of the object, if the object result a "data" (a javascript object)?

      Comment


        #4
        Your Java object is translated to JavaScript via the rules given here. If your Java Object became a JavaScript Object, you can use ordinary JavaScript operations on it, including "for..in" iteration over property names. For more information on what's possible, see any good JavaScript reference book.

        Comment

        Working...
        X