Java 6 Scripting API vs Rhino

Apologies if this isn't the right place for this question, but I can't see a more appropriate forum.
I have some classes that use the Mozilla Rhino API for invoking javascript, and I was planning to upgrade this to use the new javax.script classes in Java 6. However, there's one particular feature that seems to be missing.
In Rhino, you invoke JS functions through the Function class (See http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Function.html). This has a method construct() which invokes a JS function that has been implemented as a constructor, and returns the new JS object.
I can't find an equivalent method in the javax.script API. Am I missing something? Or was this feature deliberately left out because the new API is designed to be more general purpose, and support langauges that don't have constructors?
Thanks,
Alasdair

If it was me I wouldn't get all excited just because it seems like the java API implements something that previously required a third party library.
I know that when initially the logging api showed up I thought log4j would never be needed again. That was until I actually looked at what the logging api provided. It wasn't close. So sticking with log4j was and still is by far the better choice.
Besides the actual API you might also note that as the first version that it is more likely to have bugs than a third party library that has been around for a while.

Similar Messages

  • Problems with Java Scripting API

    Hello Everyone!
    Guys, I need help with Java scripting API. A problem is that I cannot understand how can I operate Java Object's fields and methods from the script language. I have chosen embedded javascript to work with. And I can get the fields and methods of in-box java classes (such as ArrayList for example), but I cannot work with methods and fields from my own classes!
    Here is an example:
    public class ScriptingExample {  
        class MyClass {  
            int myfield = 5;  
            int getInt() {return 7;}  
        public void runExample() {  
            ScriptEngineManager mgr = new ScriptEngineManager();  
            List<ScriptEngineFactory> factories = mgr.getEngineFactories();  
            ScriptEngineManager factory = new ScriptEngineManager();  
            ScriptEngine engine = factory.getEngineByName("JavaScript");  
            MyClass mc = new MyClass();  
            try{  
                engine.put("mc", mc);  
                engine.eval("print(mc.myfield); print(mc.getInt())"); // or engine.eval("print(mc.myfield)");
            } catch (Exception e) {e.printStackTrace();}  
    }  If I run the code with the commented part it prints "undefined" instead of "5".
    If I run the code as it is it prints error instead of "7":
    undefinedjavax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getInt. (<Unknown source>#1) in <Unknown source> at line number 1
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
    at solutiondatabase.ScriptingExample.runExample(ScriptingExample.java:26)
    at solutiondatabase.Main.main(Main.java:49)
    How can I fix it?

    Guys,
    please let me raise this topic because several new questions emerged.
    (1) How can I get all the variables created inside my engine?
    There are two kinds of variables: first kind is Java obejcts put inside the engine and second kind is the variables created in my script, such as 'var a = 4;'. How can I list all the variables of that two kinds?
    (2) Is there is a way to make 'import static' to the engine? I dont want to write MyClass.MyEnum.MyEnumItem every time. Also, I cannot put the whole enum into the engine with engine.put("MyEnum", MyEnum); I can put only enum items separately: engine.put("MyEnum", MyEnum.EnumItemA);. Thats why I ask about static import.
    (3) How can I cast engine variables back to java variables inside my java code?
    Here is my example:
    package mypackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.script.ScriptEngine;
    import javax.script.ScriptEngineFactory;
    import javax.script.ScriptEngineManager;
    public class Main
         public static void main(String[] args) throws Exception 
              ScriptEngineManager mgr = new ScriptEngineManager();
              List<ScriptEngineFactory> factories = mgr.getEngineFactories();
              ScriptEngineManager factory = new ScriptEngineManager();
              ScriptEngine engine = factory.getEngineByName("JavaScript");
              ArrayList<Double> myList = new ArrayList<Double>();
              myList.add(5.0);                    
              engine.put("MyList", myList);     
              engine.eval("MyVar = MyList.get(0);");
              System.out.println((Double)engine.get("MyVar"));
    }The result is:
    Exception in thread "main" java.lang.ClassCastException: sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.Double
    +     at mypackage.Main.main(Main.java:28)+
    Is it possible to retrieve my Double java object from the engine?
    Edited by: Dmitry_MSK on Aug 6, 2010 1:56 AM

  • Rhino support for java script

    sir i have jEditorPane and i came to know that rhino.jar file can be used to support java script.
    what is the way to make the java script support on jEditorPane
    any body has code for that?

    Hi,
    true, JEE 5 support is under way..
    Have a look at <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/712eea91-0801-0010-158a-927edb8a45bd">this</a> presentation for more details about what you can expect in the next major release of NW.
    No idea about the timelines from my side as well.
    regards,
    Ivo

  • How can I get selected EXCEL area using java script office API (v 1.0)

    Hello everyone,
    I need to get values of specified area in an excel sheet using java Script Office API. For an example,
    A1:A7 row load into array using JS. 

    And you posted to a C++ forum, not a JavaScript or Excel forum.... why? 
    Visual C++ MVP

  • Using XML file in Java script to create Google Map

    Hello,
    I work for a non-profit in San Diego as a GIS Specialist. I have had to teach myself about some scripting to create some dynamic maps, but I am still very limited in my skills, so I have had to explore the internet in order to discover various tutorials and examples that have led me on a positive path.
    Right now I am working on a Google Mash-Up that will incorporate over 14,000 records, which will appear as separate markers that will have pop-up info bubbles with additional info inside (using html), once the marker is clicked.
    Here is the XML script example that is used in the tutorial I am following:
    <markers>
    <marker lat="43.65654" lng="-79.90138" html="Some stuff to display in the<br>First Info Window"
    label="Marker One" />
    <marker lat="43.91892" lng="-78.89231" html="Some stuff to display in the<br>Second Info Window"
    label="Marker Two" />
    <marker lat="43.82589" lng="-79.10040" html="Some stuff to display in the<br>Third Info Window"
    label="Marker Three" />
    </markers>
    ...and this is how it looks when the file is retrieved by the java script and mapped: http://econym.googlepages.com/example_map3.htm
    This is the java script that creates the Google Map. I have emboldened the section of the script that retrieves the data and parses it to create the markers:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Google Maps</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA6GoL8P5zqjQlG5A5uM1ETBSUPozAscB0cY3RG8xEGnZyeom4axRySak889rVpvHYRsV4f9OZZzbboA"
    type="text/javascript"></script>
    </head>
    <body onunload="GUnload()">
    <!-- you can use tables or divs for the overall layout -->
    <table border=1>
    <tr>
    <td>
    <div id="map" style="width: 800px; height: 1200px"></div>
    </td>
    <td width = 200 valign="top" style="text-decoration: underline; color: #4444ff;">
    <div id="side_bar"></div>
    </td>
    </tr>
    </table>
    <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>
    However, it seems JavaScript is either disabled or not supported by your browser.
    To view Google Maps, enable JavaScript by changing your browser options, and then
    try again.
    </noscript>
    <script type="text/javascript">
    //<![CDATA[
    if (GBrowserIsCompatible()) {
    // this variable will collect the html which will eventualkly be placed in the side_bar
    var side_bar_html = "";
    // arrays to hold copies of the markers used by the side_bar
    // because the function closure trick doesnt work there
    var gmarkers = [];
    var i = 0;
    // A function to create the marker and set up the event window
    function createMarker(point,name,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
    // save the info we need to use later for the side_bar
    gmarkers[i] = marker;
    // add a line to the side_bar html
    side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
    i++;
    return marker;
    // This function picks up the click and opens the corresponding info window
    function myclick(i) {
    GEvent.trigger(gmarkers, "click");
    // create the map
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng( 37.251699,-119.604315), 7);
    *// Read the data from testXML2blackpoolformat.xml*
    var request = GXmlHttp.create();
    request.open("GET", "testXML2blackpoolformat.xml", true);
    *request.onreadystatechange = function() {*
    *if (request.readyState == 4) {*
    var xmlDoc = GXml.parse(request.responseText);
    *// obtain the array of markers and loop through it*
    var markers = xmlDoc.documentElement.getElementsByTagName("ConnectoryRecord");
    *for (var i = 0; i < markers.length; i++) {*
    *// obtain the attribues of each marker*
    *var lat = parseFloat(markers[i].getAttribute("lat"));*
    *var lng = parseFloat(markers[i].getAttribute("lng"));*
    var point = new GLatLng(lat,lng);
    *var html = markers[i].getAttribute("html");*
    *var label = markers[i].getAttribute("label");*
    *// create the marker*
    var marker = createMarker(point,label,html);
    map.addOverlay(marker);
    // put the assembled side_bar_html contents into the side_bar div
    document.getElementById("side_bar").innerHTML = side_bar_html;
    request.send(null);
    else {
    alert("Sorry, the Google Maps API is not compatible with this browser");
    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/
    // http://econym.googlepages.com/index.htm
    //]]>
    </script>
    </body>
    </html>
    Here is my delima--
    This is the xml format that I need to use because it can accept the rest of my excel file and loop it through the 14,000+ records to create a functioning xml file. This is just a sample (2 records) of the larger file:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <ConnectoryAug2008>
    <ConnectoryRecord>
         <lng>-117.03683</lng>
         <lat>32.944505</lat>
         <ConnectoryID>1</ConnectoryID>
         <Name>$2.95 Guys</Name>
         <StreetAddress>13750 Stowe Drive</StreetAddress>
         <City>Poway</City>
         <State>CA</State>
         <Zip>92064</Zip>
    <Marker>White</Marker>
         <IndustryGroup>Technical Services</IndustryGroup>
         <ConnectoryProfileLink>http://connectory.com/search/profile_view.aspx?connectoryId=1</ConnectoryProfileLink>
    </ConnectoryRecord>
    <ConnectoryRecord>
         <lng>-117.272843</lng>
         <lat>33.13337</lat>
         <ConnectoryID>2</ConnectoryID>
         <Name>(GLDS) Great Lakes Data Systems</Name>
         <StreetAddress>5954 Priestly Drive</StreetAddress>
         <City>Carlsbad</City>
         <State>CA</State>
         <Zip>92008</Zip>
    <Marker>Orange</Marker>
         <IndustryGroup>Technology</IndustryGroup>
         <ConnectoryProfileLink>http://connectory.com/search/profile_view.aspx?connectoryId=2</ConnectoryProfileLink>
    </ConnectoryRecord>
    </ConnectoryAug2008>
    This is the tutorial where I found the formatting techniques to successfully create the large xml file that will format/convert my excel file properly: http://www.mrexcel.com/tip064.shtml
    These variables should appear as html in the info bubble:
    <ConnectoryID>2</ConnectoryID>
         <Name>(GLDS) Great Lakes Data Systems</Name>
         <StreetAddress>5954 Priestly Drive</StreetAddress>
         <City>Carlsbad</City>
         <State>CA</State>
         <Zip>92008</Zip>
    <IndustryGroup>Technology</IndustryGroup>
         <ConnectoryProfileLink>http://connectory.com/search/profile_view.aspx?connectoryId=2</ConnectoryProfileLink>
    The "Marker" variable instructs Google Maps to label the marker with a particular color. I will be so grateful to the person(s) that helps me get through this wall that I have been hitting for a long time. It's very difficult without having the luxury of peers who know about these types of issues.
    Thank you!!

    Here is the relationship: They both contain geographic coordinates that produce a point on a map. I will use the rest of the information in the second xml file (company name, address, link, etc.) to produce the information for the bubble that will pop up once the marker is clicked.
    My problem is that I need to try to keep the second xml file in a relatively similar format, so the rest of my records will still be accepted. If I had a smaller amount of records I could place them directly into the javascript, but because there are so many records, I need to use an xml file that can be retrieved by the java script. I chose to use the second type of xml file because I can easily copy and past the 14,000+ records that are now in excel document.
    After the xml issue is corrected I need to rework the javascript that is now emboldened so that it will read the new xml file correctly. I included the first xml file so that the readers will understand what type of xml format is currently being used to produce the markers in the tutorial map.

  • How to pass values to variables in WAD 7.0 using java script

    Hi.,
    My requirement is based on WAD 7.0.
    The sales value has to displayed in WAD using graph with various chart types.
    I have created variables for plant and material group in a query.
    I have created drop down box for plant with all plants in it, check box for material group and a Submit button in WAD in FORM tag of HTML coding.
    Once all the values are set in drop down box, checkbox and if the user clicks on submit button, the values has to captured by the variables for which I have created and the graph has to be aligned to the new values in variables.
    Kindly help me how to use java script to get the values from FORM and pass it to variables.
    Regards,
    Selva

    Hi Selva,
    You do not need to use Javascript for this. Instead you can achieve this by using API Commands in WAD 7.0.
    Please configure Action on the ButtonGroup webitem to use 'Commands'.
    ->Choose Command 'Set Variables Values / SET_VARIABLES_STATE' under Commands for Web Templates
    ->Set Display Variable Screen setting to OFF
    ->Choose Query Variable for Plant, Select Variable Type as 'Binding Type', Binding Type as 'Data Provider Selection', Data Provider as the one you have assigned to the Dropdown webitem, Characteristic as 0PLANT or as that assigned to the Dropdown webitem
    ->Repeat above steps for Query Variable Material Group
    Now when you make a selection from the Dropdown webitems, the Chart output will change accordingly. Let me know if this helps.
    --Priya

  • How to get/read region item value in java script

    Hi All,
    i have text item on a page.
    how to read the item value in java script
    EXAMPLE
    P10_RESULT IS ITEM IT HAS VALUE "38.956472,-77.447777","38.999123,-77.026184","12.951497,70.668646","17.459075,78.456888"
    NOW I WANT TO REFER ABOVE ITEM VALUE IN JAVA SCRIPT LIKE
    var myPoints=new Array(&P10_RESULT.);
    SO I CAN POPULATE ARRAY WITH CORDINATES
    IT IS NOT WORKING
    WHAT IS THAT I AM MISSING.
    PLESE HELP .
    ThankS
    Rk

    region header code....
    <script src="http://maps.google.com/maps?file=api&v=2&key=&API_KEY." type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    //globals
    var bounds = new GLatLngBounds();
    var map;
    var centerPoint = new GLatLng(38.984898,-76.854549);
    var gmarkers = [];
    //var x= ""38.956472,-77.447777","38.999123,-//77.026184","12.951497,70.668646","17.459075,78.456888"";
    //var myPoints=new Array(x);
    //var myPoints=new Array($x('P10_RESULT').value);
    var myPoints=new Array(document.getElementById('P10_RESULT').value);
    //var myPoints=new Array("38.956472,-77.447777","38.999123,-77.026184","12.951497,70.668646","17.459075,78.456888");
    function initMap()
              doLoad();
                        addMarkers();
    function doLoad()
         if (GBrowserIsCompatible())
                   map = new GMap2(document.getElementById("map"));
                   map.setCenter(centerPoint, 7);
                   map.addControl(new GScaleControl());
                   map.addControl(new GLargeMapControl());
                   map.addControl(new GMapTypeControl());
    function myclick(i) {
    GEvent.trigger(gmarkers, "click");
    function addMarkers() {
         if (myPoints.length) {
              var bounds = new GLatLngBounds();
              for (n=0 ; n < myPoints.length ; n++ ) {
                   var mData = myPoints[n].split(',');
                   var point = new GLatLng(mData[0],mData[1]);
                   bounds.extend(point);
                   var marker = createMarker(mData[1],point, mData[0]);
         map.addOverlay(marker);
              map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
    function createMarker(i,point, title) {
         var marker = new GMarker(point,{title:title});
         GEvent.addListener(marker, "click", function() {
              marker.openInfoWindowHtml('<div style="width:250px;">' + title + '<hr>Lat: ' + point.y + '<br>Lon: ' + point.x + '</div>');
         gmarkers[i] = marker;
         return marker;
    //]]>
    </script>
    page body code
    onload="initMap()" onunload="GUnload()"

  • Acrobat standard 9.0 error while enabling commets option using Java script object

    I'm using the below java script code in my VB 6.0 application for enabling commets options in the PDF file
    Dim oJSO As Object
    Set oJSO = mPDDoc.GetJSObject
    oJSO.Collab.showAnnotToolsWhenNoCollab = True
    It is working fine till Acrobat 8.0. Now I'm trying with Acrobat 9.0 standard edition, it is throwing scripting error 'An unhandled Win32 exception occured in Acrobat.exe[308].
    Can anyone suggest the way to enable 'comment' options in Acrobat Standard 9.0 using Java Script Object?
    Thanks

    I get much the same problem with VB6, Acrobat 9 Pro and WinXP SP3. When I single step the line:
    oJSO.Collab.showAnnotToolsWhenNoCollab = True
    in debug I go to the error handler for my Sub. Inspecting the VB Err object has Number = -2147417851 and Description = "Automation error
    The server threw an exception." I get a Microsoft crash notice about Acrobat a short while later.
    I've experimented with the JavaScript debugger in Acrobat and you can execute Collab.showAnnotToolsWhenNoCollab = True and reference the value of Collab.showAnnotToolsWhenNoCollab in the console. The problem appears only when accessing Acrobat Javascript through the Interapplication Communication API.
    If anyone can help it would be appreciated. I tried Adobe's Acrobat support and they were no help at all.

  • Differnce between java script xml dom and Java Xml dom

    Hi,
    In my application For client side in Java Script for craetion of DOM MIcrosoft Activex object is used. USing that one they are buiidng DOM. And they are saving as XML. In server side i have to write one servlet which will parse that xml and i have to store in dynamic arrays.Which API is better for parsing XML in java.In util pacakge which class is better for storing dynamical values that means MAP,Hash Map,Hash table ??

    in java, the java..xml.parsers package is generally used for parsing xml into a DOM. there are also sax and stax parsers available.
    which class in java.util is better for storing stuff depends on what you need to do with the stuff. find a nice tutorial on java collections and then decide which one makes sense for what you need.

  • Using Vector in Java script

    I got this vector class from some website for implementation of vector in java script
    function Vector(inc) {
         if (inc == 0) {
              inc = 100;
         /* Properties */
         this.data = new Array(inc);
         this.increment = inc;
         this.size = 0;
         /* Methods */
         this.getCapacity = getCapacity;
         this.getSize = getSize;
         this.isEmpty = isEmpty;
         this.getLastElement = getLastElement;
         this.getFirstElement = getFirstElement;
         this.getElementAt = getElementAt;
         this.addElement = addElement;
         this.insertElementAt = insertElementAt;
         this.removeElementAt = removeElementAt;
         this.removeAllElements = removeAllElements;
         this.indexOf = indexOf;
         this.contains = contains
         this.resize = resize;
         this.toString = toString;
         this.sort = sort;
         this.trimToSize = trimToSize;
         this.clone = clone;
         this.overwriteElementAt;
    // getCapacity() -- returns the number of elements the vector can hold
    function getCapacity() {
         return this.data.length;
    // getSize() -- returns the current size of the vector
    function getSize() {
         return this.size;
    // isEmpty() -- checks to see if the Vector has any elements
    function isEmpty() {
         return this.getSize() == 0;
    // getLastElement() -- returns the last element
    function getLastElement() {
         if (this.data[this.getSize() - 1] != null) {
              return this.data[this.getSize() - 1];
    // getFirstElement() -- returns the first element
    function getFirstElement() {
         if (this.data[0] != null) {
              return this.data[0];
    // getElementAt() -- returns an element at a specified index
    function getElementAt(i) {
         try {
              return this.data;
         catch (e) {
              return "Exception " + e + " occured when accessing " + i;     
    // addElement() -- adds a element at the end of the Vector
    function addElement(obj) {
         if(this.getSize() == this.data.length) {
              this.resize();
         this.data[this.size++] = obj;
    // insertElementAt() -- inserts an element at a given position
    function insertElementAt(obj, index) {
         try {
              if (this.size == this.capacity) {
                   this.resize();
              for (var i=this.getSize(); i > index; i--) {
                   this.data[i] = this.data[i-1];
              this.data[index] = obj;
              this.size++;
         catch (e) {
              return "Invalid index " + i;
    // removeElementAt() -- removes an element at a specific index
    function removeElementAt(index) {
         try {
              var element = this.data[index];
              for(var i=index; i<(this.getSize()-1); i++) {
                   this.data[i] = this.data[i+1];
              this.data[getSize()-1] = null;
              this.size--;
              return element;
         catch(e) {
              return "Invalid index " + index;
    // removeAllElements() -- removes all elements in the Vector
    function removeAllElements() {
         this.size = 0;
         for (var i=0; i<this.data.length; i++) {
              this.data[i] = null;
    // indexOf() -- returns the index of a searched element
    function indexOf(obj) {
         for (var i=0; i<this.getSize(); i++) {
              if (this.data[i] == obj) {
                   return i;
         return -1;
    // contains() -- returns true if the element is in the Vector, otherwise false
    function contains(obj) {
         for (var i=0; i<this.getSize(); i++) {
              if (this.data[i] == obj) {
                   return true;
         return false;
    // resize() -- increases the size of the Vector
    function resize() {
         newData = new Array(this.data.length + this.increment);
         for     (var i=0; i< this.data.length; i++) {
              newData[i] = this.data[i];
         this.data = newData;
    // trimToSize() -- trims the vector down to it's size
    function trimToSize() {
         var temp = new Array(this.getSize());
         for (var i = 0; i < this.getSize(); i++) {
              temp[i] = this.data[i];
         this.size = temp.length - 1;
         this.data = temp;
    // sort() - sorts the collection based on a field name - f
    function sort(f) {
         var i, j;
         var currentValue;
         var currentObj;
         var compareObj;
         var compareValue;
         for(i=1; i<this.getSize();i++) {
              currentObj = this.data[i];
              currentValue = currentObj[f];
              j= i-1;
              compareObj = this.data[j];
              compareValue = compareObj[f];
              while(j >=0 && compareValue > currentValue) {
                   this.data[j+1] = this.data[j];
                   j--;
                   if (j >=0) {
                        compareObj = this.data[j];
                        compareValue = compareObj[f];
              this.data[j+1] = currentObj;
    // clone() -- copies the contents of a Vector to another Vector returning the new Vector.
    function clone() {
         var newVector = new Vector(this.size);
         for (var i=0; i<this.size; i++) {
              newVector.addElement(this.data[i]);
         return newVector;
    // toString() -- returns a string rep. of the Vector
    function toString() {
         var str = "Vector Object properties:\n" +
         "Increment: " + this.increment + "\n" +
         "Size: " + this.size + "\n" +
         "Elements:\n";
         for (var i=0; i<getSize(); i++) {
              for (var prop in this.data[i]) {
                   var obj = this.data[i];
                   str += "\tObject." + prop + " = " + obj[prop] + "\n";
         return str;     
    // overwriteElementAt() - overwrites the element with an object at the specific index.
    function overwriteElementAt(obj, index) {
         this.data[index] = obj;
    Now I have written this code .This code is written using API'sfunction getOptions(ctx)
    var options="";
    var subroles = ctx.getAdminRole().getAttributeMultiValue("CUSTOM10");
    var v = new Vector(subroles);
    options = v.getElementAt(0);
    Now suppose the function getAttributeMultivalue is returning RoleA,RoleB
    Now i want RoleA to be stored in getElementAt(0) and RoleB in getElementAt(1)
    But with the above code i am getting RoleA,RoleB in getElementAt(0)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    abhishek20 wrote:
    well the question is also about Vector class of JavaNo it is not you doofus. It is about JavaScript. Your question has fuck all to do with Java.
    so I thought to post it here.That was a mistake.
    any ways if you don't know java script or anything about vector class then you should not reply.I know about JavaScript.
    I know about Vectors.
    I will not tell you anything about JavaScript here.
    I wouldn't tell you anything useful anyway because I have taken a personal dislike to you.
    >
    No need to make me understand what is the purpose of this forum.Really? Because you don't seem to get it. At all.
    next time take care before you reply.Next time engage your tiny pea brain in some sort of logical thought before posting.

  • Java script and WAD

    Hi ,
      Can any one send me java script document or sample code for WAD . I want to custiomize the WAD using java script .
    Points will be rewarded.
    Please do not send 3.5 Web API Reference or link from SDN . That I have it already.
    Thanks,
    Aparna

    Hi Aparna,
    Here is a wonderful link which will guide you properly:
    http://www.w3schools.com/js/default.asp
    Hope it helps...
    Regards,
    Habeeb

  • How to create two level dynamic list using JSP , Java Script and Oracle

    I am new in JSP. And i am facing problem in creating two level dynamic list using JSP ,Java Script where the listdata will come from Oracle 10g express edition database. Is there any easy way in JSP that is available on in ASP.NET.
    Plz response with details.

    1) Learn JDBC API [http://java.sun.com/docs/books/tutorial/jdbc/index.html].
    2) Create DAO class which contains JDBC code and do all SQL queries and returns or takes ID's or DTO objects.
    3) Learn Servlet API [http://java.sun.com/javaee/5/docs/tutorial/doc/].
    4) Create Servlet class which calls the DAO class, gets the list of DTO's as result, puts it as a request attribute and forwards the request to a JSP page.
    5) Learn JSP and JSTL [http://java.sun.com/javaee/5/docs/tutorial/doc/]. Also learn HTML if you even don't know it.
    6) Create JSP page which uses the JSTL c:forEach tag to access the list of DTO's and iterate over it and prints a HTML list out.
    You don't need Javascript for this.

  • Java scripting for header,footer and combine PDF as package

    Hi All,
    1.How to add header and footer using scripting.
    2.How can i combine 5 pdf files in to one pdf as PDF file package using Java Scripting.
    Thanks
    Mohamed Idris

    Hi Lenonard,
    Thanks for your reply, I am refering JavaScript for Acrobat API Reference, Version 8 document , but i could not find the right syntax for the above task.
    I am sucessfull writing script for page label but not for insertion of page number in the footer section.
    Regarding combining PDF files i could merge file and it comes as single PDF file not like assembeling pdf files as package.
    Please let me know the syntax and if i am looking at not right documentation, please let me know the document name to refer.
    Thanks again.
    Mohamed Idris

  • How to call Java script from java code?Can Jscript be executed at server?

    Hi All,
    We are using 'WebTrends' tool to analyze our site usage pattern.
    To use WebTrends, we need to :
    1) call Java Script code from the java code
    2)Java script has to be executed at server.
    Please comment on two points mentioned above. If yes, please let me know how to do them?
    Thanks in advnce,
    Regards,
    Ganga

    You can check out Rhino project.
    [http://www.mozilla.org/rhino/]

  • Business Objects Dashboard External HTML/JAVA Script Link - User Authentication Depolyment Q

    <p>Hello,</p><p>I have a rather unstructured problem here and am relatively new to Business Objects Enterprise. </p><p>We have users who are authenticated through Business Objects. The login sets their access levels and permissions. In addition to the BO reports, we would also like to link through BO Dashboard a JAVA Script webpage.</p><p>The JAVA Script and Business Object software sits on the same webserver.</p><p><strong>The problem is that through BO Dashboard and also an external URL link we can only pass a static link (i.e. /some directory/some doc.html) and not a dynamic userid with the URL, which changes based on the user (i.e. /some directory/some doc.jsp?UID=user1).</strong></p><p>The solution might be to insert a Business Object API call that can determine the user who is currently logged in? Or, if there is some way around the static html link through Business Objects Dashboard?</p><p>Any ideas or thoughts would be deeply appreciated.</p><p>Thanks,</p><p>Joe</p>

    Are you setting Business Objects up as an external application?
    If so, what parameters are you using to set it up?
    Based on the fact that you're seeing the basic auth dialog, you probably need to specify
    that it's using basic auth -- not GET.

Maybe you are looking for

  • XML file issue real time

    Hi guys, My question is in a real time scenario how the file is asked for ? As for testing a simple file scenario we usually get the sample file in XI from Message mapping tool only, this sample file contains primary tag of message type with attribut

  • How do I install on XP 64

    I have recently rebuilt a new PC to run XP 64bit and wanted to use flash in Internet Explorer but have come across problems. Firstly is that there does not appear to be a 64 bit version. I am ok to wait for that. Secondly and the reason for this item

  • Interface Mapping Object - No class definition found

    Hi I have created a simple Interface Mapping in the Integration Repo. When i try to TEST the interface mapping i get class not found errors.See the stacktrace below. LinkageError at JavaMapping.load(): Could not load class: com/sap/xi/tf/_PO_MAPPING_

  • SQL Agent job running DTS package running in SQL 2005 is unable to run if job onwer is not logged onto server

    I am currently working on a SQL Server upgrade project for a a client where I am converting old dts packages to SSIS. However for a few of the packages no conversion is allowed to be done. For these few packages I have to use dts legacy components in

  • Exception while ruuning Dynamo home in Linux mechine for both instances.

    Hi All, System config :* OS : Linux Redhat 6.1 RAM : 6 GB We configured JAVA VM options in JBOSS server for Publishing and Production instances as below, set "JAVA_OPTS=-Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Dorg.jboss.resolver.warning=true -Dsun.