Object Expected Error regarding JSP and Javascript


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Object Expected Error regarding JSP and Javascript

  1. #1
    Join Date
    Nov 2005
    Posts
    6

    Object Expected Error regarding JSP and Javascript

    I'm coding a jsp page that checks for cookies and tries to run a javascript function when it detects that a certain cookie exists. I did some debugging and find that the session and cookie and be extracted and displays correctly. However, when try to test the web page on my browser, the function isn't called and the bottom left displays an error:

    Line: 31
    Char: 2
    Error: Object Expected
    Code: 0

    My codes are as follows:

    Code:
    <%@ page language="java" import="java.util.*"%>
    <%
    
    	String LoginID = request.getParameter("id");
    	if(LoginID == null)
    	{
    		response.sendRedirect("login.jsp");
    	}
    	else
    	{
    		session.setAttribute("Current", LoginID);
    		out.println(LoginID);
    		out.println(session.getAttribute("Current"));
    	}
    	
    	String cookieName = LoginID;
    	Cookie cookies[] = request.getCookies();
    	Cookie myCookie = null;
    	String container = "";
    
    		if (cookies != null)
    		{
    			for (int i = 0; i < cookies.length; i++) 
    			{
    				out.println(cookies[i].getValue());
    				if (cookies [i].getName().equals (cookieName))
    				{
    					myCookie = cookies[i];
    					out.println(myCookie.getValue());
    					break;
    				}
    			}
    		}
    		else
    		{
    			myCookie = null;
    		}
    
    
    %>
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>CRIMES-2 Training</title>
    <script>
    
    function disp_confirm()
    {
    	var choice=confirm("You have an existing bookmark." + '\n' + "Do you want to load it?")
    		if (choice==true)
    		{
    			testwindow = window.open ("<%if(myCookie==null) { out.println(container); } else { out.println(myCookie.getValue()); }%>", "_blank","location=0,status=0,scrollbars=0,width=1020,height=650");
    			testwindow.moveTo(45,110);
    		}
    		else
    		{
    
    		}
    }
    </script>
    </head>
    
    <% 	if(myCookie==null)
    	{
    %>
    <body bgcolor="#FFFFFF">
    <%
    	}
    
    	else
    	{
    %>
    <body onload="javascript: disp_confirm()" bgcolor="green">
    <%	}	%>
    
    
    
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!-- saved from url=(0013)about:internet -->
    
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="100%" id="drag menu2" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="dragmenu.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="dragmenu.swf" quality="high" bgcolor="#000000" width="800" height="600" name="drag menu2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    
    </object>
    </body>
    </html>

  2. #2
    Join Date
    Nov 2005
    Posts
    6
    bump

Similar Threads

  1. How do include a javascript file into JSP?
    By Maria Modeste in forum Java
    Replies: 7
    Last Post: 11-23-2010, 10:13 AM
  2. how to pass javascript value to jsp
    By tllcll in forum Java
    Replies: 9
    Last Post: 10-06-2005, 05:00 AM
  3. Handling XMLHttp request in JSP
    By jijesh in forum Java
    Replies: 0
    Last Post: 07-19-2005, 09:55 AM
  4. JavaScript in JSP and servlets
    By satish in forum Java
    Replies: 4
    Last Post: 11-15-2000, 09:14 PM
  5. JSP and JAVASCRIPT
    By kalak in forum Java
    Replies: 2
    Last Post: 09-04-2000, 05:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center