This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes how to pass the values and how to get the Arraylist table from java script  function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to pass the values and how to get the Arraylist table from java script  function" Watch "how to pass the values and how to get the Arraylist table from java script  function" New topic
Author

how to pass the values and how to get the Arraylist table from java script function

deva siva
Ranch Hand

Joined: Apr 29, 2005
Posts: 37
hi

how to pass the values and how to get the Arraylist table from java script function.

we have one java class file, that contains the method1 and it returs the ArrayList Table.

My java class contains the ArrayList, like

Class A
---------------
public ArrayList getMethod1(String val1,String val2)throws NoResults
{
ArrayList SUBLOBTable=new ArrayList();
some database code here
----
-------------
return SUBLOBTable;
}

IN My JSP : we create a obj for that.
--------------------
ClassA Obj = new ClassA();

Now my question like �how to access that SUBLOBTable from javascript�

IN javascript

----------------------------------
var jsObj = "<%=Obj%>"; //i creaate a var which contains the obj of that ClassA file

var mylist = new Array();

mylist = jsObj.getLOB(GRP_Type,LOBL); //it gives the object doesnot support this property or method.

var s1=mylist.size();

for (i=0;i<s1;i++)

{

-------

--------------



}
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Looks like getLOB is not in your JavaScript code, or you have it defined after the statement when it needs to be listed before it.

Eric
deva siva
Ranch Hand

Joined: Apr 29, 2005
Posts: 37
Here MyMethod1 is getLOB
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
JavaScript can not use a Java function.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Moving this thread to the JSP forum, which is closer to the topic.
Please continue the discussion over there. Thanks.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

Originally posted by Eric Pascarello:
JavaScript can not use a Java function.


Please read this article for an explanation why,


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: how to pass the values and how to get the Arraylist table from java script function