I am using the following code to include some java script (- no error messages are being displayed, but it is not working):
<jsp:include page = "validation.js" flush = "true" />
I also placed this in the header tags:
As well as in the form tag I placed the usual code:
<form name="claimform1" onSubmit="return Claim(this)" id="claimform1" method="post" action="Claim_Form_2.jsp">
Last edited by Maria Modeste; 10-16-2005 at 07:50 AM.
Include .js file in a JSP page
I am also having an issue including a .js file on the JSP page. Need a few examples of how to code the page that includes the dynamic drop down list.
I am having the same problem including jQuery in my JSP:
I have a local copy of the jQuery file sitting in the root context and I'm using Tomcat 6.
<?xml version="1.0" encoding="UTF-8"?>
<jsp:directive.page contentType="text/html; charset=UTF-8" />
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
The text "Blank" does not appear and if I test any jQuery functionality, it doesn't work. This was tested in IE8 and Chrome with the same effect.
If I rewrite this in pure HTML, then the "Blank" text does appear:
Why is the script failing in JSP, but not in HTML?
<!DOCTYPE HTML "-//W3C//DTD XHTML 1.0 Strict//EN"
At a glance I'd say the problem is that you've specified the <jsp:output> element (which outputs the <html> element into the generated HTML) as an empty element. Thus your <head> and <body> elements are outside the generated <html> element, and since you've specified a valid DOCTYPE, the browser is in Standards mode and considers this a malformed document.
Remove the trailing slash in the <jsp:output> tag, and add a closing </jsp:output> tag after your closing </body> tag. That should give a valid HTML document for your browser to parse.
I'm afraid <jsp:output> is not allowed to have a body, so it must always be written <jsp:output />
The only workaround that I've found that works is a full inclusion of the js file in the body of the page, like so:
<jsp:include page="jquery-1.4.4.min.js" />
By jase_dukerider in forum C++
Last Post: 04-14-2005, 07:48 PM
By Tomer Cagan in forum ASP.NET
Last Post: 07-24-2001, 09:01 AM
By Beginner in forum ASP.NET
Last Post: 12-01-2000, 11:45 AM
By Paul in forum Database
Last Post: 08-22-2000, 10:54 PM
Last Post: 05-31-2000, 10:30 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL