Jsp calling a function in js -- object expected runtime error

Hi,
I have a js file. script.js
*function popup( url ) {*
newWin=window.open(url,'popupWindow,resizable=yes,menubar=no,status=no,toolbar=no,scrollbars=yes');
newWin.focus();
void(0);
and a jsp calling the function in js
*<HTML>*
*<HEAD>*
*<SCRIPT>*
*<jsp:include page="script.js"/>*
*</SCRIPT>*
*</HEAD>*
*<BODY onLoad="javascript:popup('http;//www.google.com');">*
*</BODY>*
*</HTML>*
Now when i execute the jsp, it gives runtime error -> object expected..
Not able to figure out why this occurs.. am I doing it the right way ?

Do you think is this the right way to include .js file...
<SCRIPT>
<jsp:include page="script.js"/>
</SCRIPT>I generally do this way...
<head>
<script language="javascript" src = "script.js">
</script>
</head>

Similar Messages

  • Calling a function on an object passed as argument

    Hi everyone,
    i'm trying to call an actionscript function on an object passed as argument to a c function. Here are how I do :
    I have a class named test_class implemented as
    package
         public class test_class
              public var bliblou:int;
    and a C function that have to modify the bliblou var of an test_class object passed as argument. Here is my function :
    static AS3_Val test_obj_param( void* self, AS3_Val args )
         AS3_Val obj;
         AS3_ArrayValue( args, "AS3ValType ", &obj );
         AS3_Set( obj, AS3_String("bliblou"), AS3_Int( 123456 ) );
         return AS3_Null();
    Then I call the function in my actionscript main function like this :
    var loader:CLibInit = new CLibInit;
    var lib:Object = loader.init();
    var test:test_class = new test_class();
    lib.test_obj_param( test );
    But when the test_obj_param is trying to run, I obtain an error saying "unable to access a propriety of a null object".
    What am I doing wrong ? Is it possible to do what I try to (calling a function on an object passed as argument) ?
    Thanks in advance

    After a long trip to Alchemy possibilities and a lot of tests I have finally found a solution to my question.
    Instead of using AS3ArrayValue to get my objet, I use the AS3 function shift on the args array to get my object. Here is how I do
    static AS3_Val test_obj_param( void* self, AS3_Val args )
         AS3_Val emptyParams = AS3_Array("");
         AS3_Val obj = AS3_CallS( "shift", args, emptyParams );
         AS3_SetS( obj, "bliblou", AS3_Int( 123456 ) );
         AS3_Release(emptyParams);
         return AS3_NULL();
    Maybe there is a bug in the AS3ValType getter.

  • Can we call custom functions in view objects?

    Can we call custom functions in view objects?these custom functions are from my backing bean...
    Please help.....

    User,
    You can certainly add code to your view objects to do whatever you like.
    However, it would be considered a very bad practice to call something in the backing bean from your view object. It violates the whole MVC design principle of ADF.
    Perhaps if you can share your real use case, someone will give you ideas about the best way to do it, but I, for one, would advise you to forget about calling a backing bean function from your view object.
    Best,
    John

  • Calling a function of an object

    If I have an object, and then create a function in this
    object, what syntax
    do I use to call this function?
    SEND_VOTE_OBJECT = new Object();
    SEND_VOTE_OBJECT.SEND_VOTE=function(){
    //function code
    SEND_VOTE_OBJECT.SEND_VOTE();
    I thought this would work but it doesn't!
    What would be the correct syntax?
    Many thanks
    Dave

    Thanks for the reply, it has made me look closer.
    In my actual code I was calling the function before the
    function was
    defined, and that was why it wasn't working.
    i.e like this
    SEND_VOTE_OBJECT = new Object();
    SEND_VOTE_OBJECT.SEND_VOTE();
    SEND_VOTE_OBJECT.SEND_VOTE=function(){
    trace('hi')
    "NSurveyor" <[email protected]> wrote in message
    news:e7m93a$29d$[email protected]..
    > That code works fine:
    >
    > SEND_VOTE_OBJECT = new Object();
    >
    > SEND_VOTE_OBJECT.SEND_VOTE=function(){
    > trace('hi')
    > }
    >
    > SEND_VOTE_OBJECT.SEND_VOTE();
    >
    > As you can see, hi is traced in the output panel, as it
    should. Perhaps
    > you
    > have a problem with your function code. If you post
    that, perhaps I can
    > help.
    >

  • JAVA Calling Oracle Function and Returning OBJECT

    HI,
    I am working as a developer in java/j2ee project.
    I am facing one issue:
    I need to call Oracle function from java code. Oracle User define function is residing in oracle package and returning Object which contains data.
    Can you please help me
    With Best Regards

    golduniya wrote:
    I need to call Oracle function from java code. Oracle User define function is residing in oracle package and returning Object which contains data.
    Can you please help meIt requires a great deal of Oracle jdbc driver specific code.
    [http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraint.htm#1012664]

  • Call package function in view object

    ok i have a viewobject with a select statement to a table.
    in the where clause i would like to call to a package function,
    how can i do this?

    If you can call the function in a sql statement (i.e. in SQLDeveloper) you can use expert mode in the VO and type in the sql statement there. It should work like in SQLDeveloper.
    Timo

  • "Object expected" JavaScript error in IE7/IE8 using AC_RunActiveContent v1.7

    So this is a low-priority but annoying problem I seem to be having on a site with the AC_RunActiveContent embedding script that Flash CS3 automatically generates (v1.7, according to the comments). In IE7 and IE8, I keep getting these alerts when the page first come up:
    Line: 39
    Char: 1
    Error: Object expected
    Code: 0
    URL: etc.
    What's weird is that Line 39 of the file seems to be in the midst of a try-catch thing, so I don't see why that error should even be showing up. Mind you, the site is working fine - the Flash shows up fine - like I said, not high-priority. I'd just like to try and get rid of that error if I can. Anyone else have any idea what's going on here, and how I might be able to fix it?

    Bump. Also, additional details: Yes, I did upload the script to the server. Yes, it's being found and read properly by the browsers, including IE7 and IE8; I've confirmed this using the Developer's Toolbar. So it's not the same problem that everyone who's asked about this before has had; yes, I did dig up those posts via Google before I came here, and yes, I have made sure. So any other thoughts?

  • Why can't I call the function in the swf from the javascript?

    Hello,
    I have an html file that calls the function in swf file. In the swf file, I registered the function to be called using ExternalInterface.addCallback, as the book says.
    And I put this swf file in the html file using <object> tag and attempted to call the function using this object's id attribute.
    But every time to run this file, what I see is the error message such as "test1.show is not a function".
    Why is it?
    Please anyone help me. I am enclosing my work file. It's very simple one.
    Thank you.
    Daniel.

    It is entirely possible your college has decided to block certain websites. It's easy to do.

  • Call a function, which name is in an Array of Strings...

    hey all
    i have a simple Temp class (made to check things) in a file called Temp.java with the following definition :
    public class Temp {
         int data1;
         int data2;
         public Temp (){
              data1=0;
              data2=0;
         (here i have get and set functions for both data1 and data 2, and i have the two following functions)
         public void printAdd(){
              System.out.println("Result : "+(data1+data2));
         public void printSubtract(){
              System.out.println("Result : "+(data1-data2));
    }i have another class called Server who has the following simple code :
    public class Server {
          public static void main( String args[] )
               String[] table={"printAdd","printSubtract"};
               Temp game=new Temp();
               game.setdata1(8);
               game.setdata2(4);
              //the following two calls work perfectly
               game.printAdd();
               game.printSubtract();
                   System.out.println(table[0]);
    //but the following does not...
               game.(table[0]);
    }as probably you have understood i am trying to call a function to the object game which name is in the String table... how can i actually made a call game.(THE_VALUE_OF_STRING_IN_AN_ARRAY) ...?

    i want to call the function printAdd() to the game object..
    but i want the program to find out the name of the function to call.. i want to execute the function whose name is at the array in position 0 -> table[0]
    so i want the program to resolve the table[0] to printAdd and the use it and call it on object game...

  • Call of function module "SUBST_START_BATCHJOB" by RFC failed

    Hello Guru's,
    We have the following Issue:
    In Phase PREP_INIT/JOB_RSUPDTEC we get this error from EHPI (Version 710-1)
    Checks after phase PREP_INIT/JOB_RSUPDTEC were negative!
    Last error code set: BATCHJOB RSUPDTEC FAILED: Calling RSUPDTEC failed - repeat phase.
    In the file PSUPDTEC.LOG are the following error:
    4 ETQ260 Starting batchjob "RSUPDTEC"
    4 ETQ230 Starting RFC Login to: System = "E11", GwHost = "sape11", GwService = "sapgw00"
    4 ETQ359 RFC Login to: System="E11", Nr="00", GwHost="sape11", GwService="sapgw00"
    4 ETQ232 RFC Login succeeded
    4 ETQ233 Calling function module "SUBST_START_BATCHJOB" by RFC
    4 ETQ399 JOBNAME='RSUPDTEC', REPNAME='RSUPDTEC', VARNAME='', BATCHHOST='sape11', IV_SCHEDEVER=' '
    4 ETQ234 Call of function module "SUBST_START_BATCHJOB" by RFC succeeded
    4 ETQ399 Returned JOBCOUNT='14230100'
    2EETQ235 Call of function module "SUBST_START_BATCHJOB" by RFC failed (error-status "27")
    2EETQ261 Start of batchjob "RSUPDTEC" failed
    In the Sysem we can see, that the Job RSUPDTEC was created by DDIC but not started.
    We can start (and finish) the job successfully as logged in DDIC.
    We don't know whats the problem. The EHPI stopped every time at this point.
    Need Help...
    regards
    Chris

    Issue solved.
    In /etc/hosts the first entry was SAPE11.
    But it must be sape11, because the instance is sape11_E11_00.
    In SM51 we could see that
    sape11_E11_00     SAPE11     Dialog Batch Update Upd2 Spool Enqueue ICM     active
    We changed the entry and restarted SAP.
    Then the job can be started.

  • A Runtime Error Has Occured Do you wish to Debug? Line 90 Error: Object Expected

    A Runtime Error Has Occured Do you wish to Debug? Line 90
    Error: Object Expected
    This error is recieved when trying to open "The Fan" video
    news Page from Comcast, This error appears and when you select yes
    or no, the page comes up to install Adobe Flash Player, however
    even after installing it, the error still appears when attempting
    again, even after restart, this does not occur on Firefox, only
    IE

    Also I am on Windows Vista

  • Object Expected error in Struts JSP file

    Hi,
    I have a very simple JSP file as shown below.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ taglib uri="/tags/struts-html" prefix="html" %>
    <html>
    <head>
    <title>pqGlobalStoreProfile.jsp</title>
    </head>
    <body onLoad="getSessionData();disableFieldsLocale();">
    <html:form action="/pqGlobalStoreProfile.do">
    <table cellpadding=5 cellspacing=0>
         <tr><td colspan=2><h3><b>Pq Global Store/Modify Profile</b></h3></td></tr>
         <tr><td>Profile Key *</td><td><html:text property="profileKey"/></td></tr>
    </table>
    </html:form>
    </body>
    </html>
    It is throwing an "Object Expected' error at Line 9 Char 1.
    I am not sure about what is causing this error.
    Thanks.

    it's a Javascript error, cuz it's calling these 2 methods when the page loads...
    onLoad="getSessionData();disableFieldsLocale();"
    Where are these methods defined? Cuz I don't see any inline Javascript, nor a linked script.
    I hope you don't think that those onload functions are going to call Java code defined in the JSP page or something, cuz... well, they aren't.

  • Not Able To Call JavaScript Function in my JSP file

    Here is my code of jsp, its a form , now when i click on the submit button having value "check all", it doesnot call the function
    "CheckAll( )" which will just popup the alert box, when i click on the "check all" button but it gives following error
    object expected,line no 66
    can somebody help me
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="java.util.*"%>
    <%@ page import="dao.dbconnect" %>
    <% response.setHeader("Pragma","no-cache");%>
    <% response.setHeader("Cache-Control","no-store");%>
    <% response.setDateHeader("Expires",-1);%>
    <html>
    <head>
    <script type="text/javascript" src="calendarDateInput.js">
    function CheckAll()
         alert("hi");
    </script>
    </head>
    <body >
    <form name="inserttransaction" action="InsertTransaction" method="get">
    <TABLE border="0" cellpadding="2" cellspacing="2" align="center">
    <thead>
    <tr bgcolor='999999'>
                             <FONT SIZE="10" COLOR="white">
    <th width="20%">    </th>
    <th width="20%">    </th>
    <th width="25%">    </th>
    <th width="35%">    </th>
    </tr>
    </thead></FONT>
    <tbody>
    <TR bgcolor='CCCCCC'>
         <TD>Amount: </TD>
         <TD><input type="text" name="amount" value="" size="5" maxlength="5" ONKEYPRESS="if ((event.keyCode < 48) ||
    (event.keyCode > 57)) event.returnValue = false;"/></TD>
         <TD>Date Of Expenditure</TD>
         <TD><script >DateInput('orderdate', true, 'DD-MON-YYYY')</script></TD>
    </TR>
    <TR bgcolor='ffff'></TR>
    <TR bgcolor='CCCCCC'>
         <TD>Type Of Expenditure:</TD>
         <TD><select name="expendituretype" onBlur=ONKEYPRESS="if ((event.keyCode < 48) ||
    (event.keyCode > 57)) event.returnValue = false;">
    <option value="" selected>Select</option>
    <option>Grossary</option>
    <option>Entertainment</option>
    <option>Travelling</option>
    <option>Electric Bill</option>
    <option>RoomRent</option>
    <option>Hotel</option>
    <option>Picknik</option>
    <option>Other</option>
    </select></TD>
         <TD>Expenditure Detail:</TD>
         <TD><input type="text" name="expendituredetail" value="" size="36" /></TD>
    </TR>
    <TR bgcolor='ffff'></TR>
    <TR bgcolor='CCCCCC'>
         <TD>Paid By:</TD>
         <TD><select name="paidby">
                                  <option value="" selected>Select</option>
                                  <%
                                       session = request.getSession(true);
         this is line 66 ==========>                              Vector units=(Vector)session.getAttribute("vectobj");_
                                       out.print(units);
                                       for(int i = 0, size = units.size(); i < size; i++)
                                            out.print ("<option value=" + (String)units.get(i) + ">");
                                            out.print(units.get(i));
                                            out.print("</option>");
                                  //     out.print ("</select>");
                                  %>
                                  </select></TD>
         <TD>Add Beneficiary:</TD>
              <TD>
              <input name="btn" type="button" onclick="CheckAll()" value="Check All"> 
         <%
                                                 session = request.getSession(false);
                                                 Vector v=(Vector)session.getAttribute("vectobj");
                                                 int k=v.size();
                                                 for (int i=0; i<k; i++)
                                                                out.print("<INPUT TYPE=\"checkbox\" NAME=\"abc\" VALUE="+v.get(i).toString()+">" + v.get(i).toString() + " ");
                                            %>     
                                            </TD>
    </TR>
    </tbody>
    </TABLE><BR><BR><BR>
    <CENTER><INPUT TYPE="submit" value="Submit Transaction Data"></CENTER>
    </form>
    </body>
    </html>

    If I were you, I would post only the problematic code.. in the code tags !!
    Your obvious problem is you arent using your script tags properly. Understand this for yourself.This is your working code :
    <html>
    <head>
    <script>
    function CheckAll(){
    alert("hi");
    </script>
    </head>
    <body >
    <input name="btn" type="button" onclick="CheckAll()" value="Check All">
    </body>
    </html> HTH

  • Dynamically catch a function call from an object at runtime

    Hi,
    I have a bit of an interesting question.
    Say I have a dynamic object named Foo. It may have a set of explicitly defined functions:
    public function helloWorld():String
         return "hello world";
    public function get name():String
         return "My Name";
    etc.
    I want to be able to create a further function
    public function handleFunctionCall(functionCall:String, args:Array):*
         trace("Function: " + functionCall + " was called with the arguments:");
         for(var i:int=0; i<args.length; i++)
              trace(args[i]);
    The purpose of this is so that I can declare the object Foo and then call any function and handle it accordingly at runtime.
    e.g.
    var foo:Foo=new Foo();
    foo.bar();
    foo.whathaveyou();
    foo.whatever();
    Hope someone can point me in the right direction.

    I'd be interested to know more about what you are trying to achieve, but the code below should work:
    public function handleFunctionCall( functionName : String, args : Array ) : *
       var functionToCall : Function = this[ functionName ];
       return functionToCall.call( this, args );
    For alternative approaches you may want to take a look at behavioural design patterns. The command or strategy pattern may suit your needs.

  • How to call a function from Java to JSP

    Hello,
    I have a question about using tags.
    I have a java file,which has a function. Now I want to call this function into my JSP page.
    I'm using JSP 1.2 and TOMCAT 4.1 with Java2 SDK.
    I search through the web and find a method to do this.Bu it requires JSP 2.0
    But I try that in my machine(using JSP 1.2).It gives an error:
    Did you know what is the error? Or is there any method to call a function into my JSP page?
    Please, help me to solve this.
    Here are my codes(part of them)
    UserPassword.java file
    package data;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class UserPassword
         public static String verify(String username,String password){
              // some codes
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
            PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
         "http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>simple</short-name>
      <uri>http://jakarta.apache.org/tomcat/HRM/WEB-INF/lib</uri>
      <description>
         A  tab library for the login
      </description>
    <function>
            <description>verify username and password</description>
            <name>verify</name>
            <function-class>data.UserPassword</function-class>
            <function-signature>String verify(java.lang.String,java.lang.String)
            </function-signature>
    </function>
    </taglib>I put this file into the webapps/HRM/WEB-INF/lib folder
    Here is my JSP file.
    <%@ page language="java" %>
    <%@ page import="data.UserPassword" %>
    <%@ page session="true" %>
    <%@ taglib prefix="login" uri="/WEB-INF/lib/LoginVerify.tld" %>
    <jsp:useBean id="useraccount" class="data.UserPassword"/>
    <jsp:setProperty name="useraccount" property="*"/>
    <%
    String status = UserPassword.verify(String username,String password);
    String nextPage = "MainForm.jsp";
    if(status.equals("InvalidU")) nextPage ="InvalidUserName.jsp";
    if(status.equals("InvalidP")) nextPage ="InvalidPassword.jsp";
    if(status.equals("main")) nextPage ="MainForm.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>
    Here is the error:
    org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/lib/LoginVerify.tld: (line 18, col -1): Element "taglib" does not allow "function" here.
         at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:189)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:247)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:183)
         at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
         at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)Please, help me to solve this trouble.
    Thanks.

    Yes. As serlank showed, you can just call the function easily in scriptlet tags
    However the whole point of a tag library is to avoid the use of scriptlets.
    Seeing as you can't use functions, is just to do it as a standard tag.
    ie in your jsp
    <login:verify name="<%= userName %>" password = "<%= password %>" resultVar = "status"/>
    <c:choose>
      <c:when test="${status == 'InvalidU'}">
        <c:set var="nextPage" value="InvalidUserName.jsp"/>
      </c:when>
      <c:when test="${status == 'InvalidP'}">
        <c:set var="nextPage" value="InvalidPassword.jsp"/>
      </c:when>
    </c:choose>In your case, this tag in the tld would possibly look something like this.
    You would then have to write a tag handler class that would call the function you want.
    <tag>
      <name>verify</name>
      <tagclass>com.tags.login.Verify</tagclass>
      <teiclass>com.tags.login.VerifyTEI</teiclass>  (if required)
      <bodycontent>JSP</bodycontent>
    // name attribute 
    <attribute>
          <name>name</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
        </attribute>
    // password attribute
        <attribute>
          <name>password</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
        </attribute>
    // result variable to return a response from the tag.
      <variable>
        <name-from-attribute >resultVar</name-from-attribute >
        <variable-class>java.lang.String</variable-class>
        <declare>true</declare>
        <scope>AT_END</scope>
      </variable>
    </tag>Hope this helps some, and doesn't confuse too much :-)
    Cheers,
    evnafets

Maybe you are looking for

  • MODEL clause to process a comma separated string

    Hi, I'm trying to parse a comma separated string using SQL so that it will return the parsed values as rows; eg. 'ABC,DEF GHI,JKL' would return 3 rows; 'ABC' 'DEF GHI' 'JKL' I'm thinking that I could possibily use the MODEL clause combined with REGUL

  • Line width of e-mail

    Some e-mail text displays with lines of fixed width, i.e., text appears as a column and doesn't fill the whole width of the pane. Is there a way to undo this, so that I have complete control of the width of text by resizing the pane? iMac PPC G5   Ma

  • JCO RFC provider and JCO connection

    Hi all: Please share your thoughts on the following doubts I have. Thanks. 1. To my understanding, we use JCO RFC provider(define in Java side) and RFC destination(in SM59) when we have request from ABAP to Java side. Then we use JCO destinations(def

  • Abap module pool

    why we use vcontrol lines in tabstrip control

  • Sharing servletcontext with an object

    Hi If I create an object through a servlet or JSP, an object that is not a servlet itself, how can I get a copy of the ServletContext to that object (so it can use other objects in the ServletContext) other than passing in the ServletContext in a con