In any case, the scope of JavaScript is limited to a single page. You'll need to carry data from the first page to the second if you want cumulative validation.
If you are new to JSP, it's important to use good practices right off the bat. That means never putting Java code or scriptlets in a JSP. That's very outdated and a poor practice.