aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript "object expected " error" Watch "javascript "object expected " error" New topic
Author

javascript "object expected " error

albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
when i run my jsp page, the error "object expected" come out in my prototype program. here i stick on the code for the expert here to give some opinion to me.


JAVA the only can called technology
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Moved to the HTML/Javascript forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
"Object expected" is pretty much equivalent to "Null pointer exception" in java.
Something is null.

There is way too much code there to give any reasonable answer.
If you could get a line number, or approximate region from where the error is coming, post that segment of code, but this is too much. Particularly with scriptlet code mixed in as well.

You do realise that java and javascript don't mix?
ie the java is executed, and produces HTML which is sent to the page.
The java code is NOT executed on as part of calling the javascript function "ret_data"

Tips for debugging javascript.
- View source on the generated page. Save it as HTML. Fiddle with the HTML until the javascript is fixed, and then apply those fixes to the JSP.
- I recommend putting alert('Here we are'); at appropriate places through the script to see at which point it stops running. That helps to pinpoint the error.
- you can type in the address bar of the browser stuff like "javascript:alert(document.forms[0].myField)" This gives you a dynamic evaluator.
- Mozilla/Firefox has an excellent inbuilt javascript debugger.
Linda Walters
Ranch Hand

Joined: Apr 30, 2005
Posts: 100
I debug web applications on a daily basis in my work, including Java servlets, HTML, JavaScript, CSS, XSL, yada, yada, yada, the whole alphabet soup. The best recommendation that I can make is to get one of the Mozilla family of browsers (Mozilla, Firefox or SeaMonkey). My personal preference is Firefox. Once you have it installed, click on Tools|Extensions and click on "Get More Extensions" in the lower right corner. On the Extensions page select "Developer Tools" from the menu and Search for "JavaScript Debugger" this should take you to the page for verions 0.90.87 of the debugger. Follow the installation instructions.

I don't remember off hand if the JavaScript Console and DOM Inspector are currently built into Firefox. If they are, they will be under the Tools menu on Firefox's menu bar. If not, then search for them on the extensions page.

The JavaScript Console is VERY helpful if you don't know where the bug is occurring. As long as it is throwing a JavaScript error it will be caught by the console. When it is, just double click on the line in the console and it will take you right to the offending line in the JavaScript file.

This is a really great suite of tools and I use it every single day.
(No, I do not work for Mozilla)


<a href="http://labryssystems.net/pblog/index.php" target="_blank" rel="nofollow">Javaville Gazette</a><br />Non-cooperation with evil is a duty. -- Mahatma Gandhi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript "object expected " error