11 Replies Latest reply on Jun 24, 2009 7:58 AM by -==cfSearching==-

    Array of Struct values to Java.

    Srinivas VK

      Hi,

       

      I am looking to send the array of struct values to the Java method. Whats the better way to do it?

      For a simple paratmeter i am able to call method. but i am looking to send the array of struct values to java mthod. but its not working as there is such thing in java.

       

      does any have  any solution for this.

      This is what i am looking:

      <cfset myBook = ArrayNew(2)>

      <cfset myBook1 = StructNew()>
      <cfset a = StructInsert(myBook1, "title", "Title", 1)>
      <cfset a = StructInsert(myBook1, "author", "Author", 1)>
      <cfset a = StructInsert(myBook1, "description", "Book Description", 1)>
      <cfset a = StructInsert(myBook1, "publishyear", "Publish Year", 1)>
      <cfset a = StructInsert(myBook1, "isbn", "ISBN Number", 1)>

      <cfset myBook2 = StructNew()>
      <cfset a = StructInsert(myBook2, "title", "More ColdFusion", 1)>
      <cfset a = StructInsert(myBook2, "author", "David Medlock", 1)>
      <cfset a = StructInsert(myBook2, "description", "More ColdFusion Info", 1)>
      <cfset a = StructInsert(myBook2, "publishyear", "2005", 1)>
      <cfset a = StructInsert(myBook2, "isbn", "321654DCBA", 1)>

       

      <cfset myBookArray = ArrayNew(1)>
      <cfset myBookArray[1] = myBook1>
      <cfset myBookArray[2] = myBook2>
      <cfdump var="#myBookArray#">

      <cfobject action = "create" type = "java" class = "SimpleMethod" name = "objSimpleMath">
      <cfset retval = objSimpleMath.test(myBookArray )>

      I cant able to pass the myBookArray  to the java method test. what kind parameter should it be. ?

       

      Thanks in advance.

       

      Srinivas