I have created a jsp page having a spring form. I want to validate the form using angular js. When I try to add <strong>required</strong> and <strong>ng-model</strong> attributes inside
<form:input> tag, I'm getting exception Jasper exception
equal symbol expected and
Attribute ng-model invalid for tag input according to TLD in the line where i added these attributes.
What is the procedure to make my logic work?Answer1:
There are 4 things you can try:
First one: Probably the neatest, and I think this should work:
<form:input path="usrname" maxlength="12" required="required"/>
So required='required' instead of just required
Second one: Forget about Angular Validation, and use Spring Validation methods. Maybe this isn't the thing you're searching for.
Third one: Isn't it possible for you to forget about
<form:input> tags, and use
<input> tags instead? Maybe not.
Fourth one: You can try to give your form:input tag an id, and at the bottom of your page, run a simple jQuery script. I know, this isn't the neatest thing to do, but maybe it works.
<html> <body> <form:input path="someinput" id="someinput"/> </body> <script> $("#someinput").attr('required', ''); </script> </html>
Please mark this as an answer if this helped you.