javascript -- Error : Xarray is uninitialized

Discussion in 'JavaScript and AJAX' started by sakthi.abdullah, Jul 26, 2007.

  1. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    When I am loading a javascript file ,it is giving error :

    "Done! But with errors on page""

    "Error: XYArray is undefined "...
    goes on for multiple arrays like this ...

    how to solve this??
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
    It seems you have not defined the Array.
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Yeah shabbir is right! Please post the code snippet!
     
  4. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    okay....
    Here is the code:

    inside Lvalues.jsp I am having some n no of Arrays declared like this :

    <%
    response.setContentType("application/x-javascript");
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pramga", "no-cache");
    %>

    var XArray=new Array(
    "ALL||ALL",
    "06||06"
    ,"1N||1N"
    ,"1X||1X"
    ,"1Y||1Y"
    ,"21||21"
    ,"30||30"
    }


    In other jsps I am referring this jsp file...
    Though named as jsp,since this is a javascript code, i tried sth like this:
    I replaced

    <script type="text/javascript" language="Javascript" src="js/LValues.jsp">

    with

    <script type="text/javascript" language="Javascript" src="js/LValues.js">




    When I did that, it is producing the error

    XArray is undefined .... //for all the arrays..

    and in the log file, I am getting like this..

    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 896 copying 4 bytes
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 897 read class attr -- 'reuse'
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 898 copying 4 bytes
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 899 copying 4 bytes
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 900 read class attr -- '_jspx_th_mbs_005fsecure_005f0'
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 901 read class attr -- 'Lcom/mbs/security/util/SecurityTag;'
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 902 read class attr -- 'SourceFile'
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - 903 read class attr -- 'starCycle_jsp.java'
    119971 DEBUG [http-8090-Processor25] org.apache.jasper.compiler.SmapUtil$SDEInstaller - SourceDebugExtension not found, installed at: 904
     
  5. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Code:
    var XArray=new Array(
    "ALL||ALL",
    "06||06"
    ,"1N||1N"
    ,"1X||1X"
    ,"1Y||1Y"
    ,"21||21"
    ,"30||30"
    }
    
    Look at the code, you started the Array with '(' but ended it with '}'
     
  6. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    That's typo...The array declaration is fine..

    Please tell will these options work???
    Just call the files .js instead of .jsp or:
    remove line feeds.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice