简体   繁体   中英

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. 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.

I tried to include it in this way in the jsp page.

The validation script looks like this:

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

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.

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" . Remove the spaces in Property Management System and try. It should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM