[英]Inline javascript validation does not work for jsp files
I am working on a java based web application which is being designed using jsp and servlets. 我正在使用jsp和servlet设计基于Java的Web应用程序。 I am having a difficulty with a form validation script in my project.
我在项目中遇到表单验证脚本时遇到困难。
I need to include an external javascript file in one of my jsp pages. 我需要在我的jsp页面之一中包含一个外部javascript文件。
I tried to include it in this way in the jsp page. 我试图以这种方式将其包含在jsp页面中。
The validation script looks like this: 验证脚本如下所示:
https://github.com/nirmaniPathiranage/Hotel-Property-Management/blob/master/WebContent/js/script.js https://github.com/nirmaniPathiranage/Hotel-Property-Management/blob/master/WebContent/js/script.js
And the form looks like this: 表单如下所示:
https://github.com/nirmaniPathiranage/Hotel-Property-Management/blob/master/WebContent/Register.jsp https://github.com/nirmaniPathiranage/Hotel-Property-Management/blob/master/WebContent/Register.jsp
But when I am running the application, the system behavior seems like no script is running. 但是,当我运行应用程序时,系统行为似乎没有脚本在运行。 The expected validations are not activated.
预期的验证未激活。
I have no idea about this. 我对此一无所知。 I have included both the .js and .jsp files inside the WebContent folder of the project.
我已经在项目的WebContent文件夹中同时包含了.js和.jsp文件。
I can't seem to figure this out. 我似乎无法弄清楚。 Any help would be appreciated.
任何帮助,将不胜感激。
There should be no spaces in your path type="${pageContext.request.contextPath}/Property Management System/WebContent/js/script.js"
. 路径中不应包含空格
type="${pageContext.request.contextPath}/Property Management System/WebContent/js/script.js"
。 Remove the spaces in Property Management System
and try. 删除
Property Management System
的空格,然后尝试。 It should work. 它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.