Meaningless Drivel is fun!*
The moose likes JSP and the fly likes JSP not calling JS file funtion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP not calling JS file funtion" Watch "JSP not calling JS file funtion" New topic

JSP not calling JS file funtion

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
I gus

I have a simple Javascript (.js) file with some client validation for the registration details of users on my site.
The problem is, the JSP doesn't call the Javascript function on 'submit.

The JSP looks like this:

And the Javascipt file is under glassfish: <app>/<war>/javascript/reg_validation.js

Any help?


ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403

Src path for javascript seems ok. Are you getting any error on your browser (yellow exclamation mark under baseline left of your screen). Can you post your contents for js file ? Which browser are you using for this ?

Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
David Newton

Joined: Sep 29, 2008
Posts: 12617

Is the JS file *in* the war?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

The URL for the script file is likely missing the context path.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Thanks for the help guys, check my 'stoopid' typo:

# password: <input type="text" name="password" id="pwd" value="" />

password & pwd?

I agree. Here's the link:
subject: JSP not calling JS file funtion
Similar Threads
Quick question about reading a Bean reading a JSF inputLabel
validate form fields using javascript in struts
Can't get RequestDispatcher forward() method or response.sendRedirect() to work
how to keep register page data if register fails
Can you post data from textfields to a URL without having a <form>