1

I have created a jsp page having a spring form. I want to validate the form using angular js. When I try to add required and ng-model 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?

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

9 Comments

Thank you @Kornelito. Your answer solved my required attribute problem. Even my ng-model is getting jasper exception. Can you please help me out in that?
Yes offcourse. Could you please post your code where you use ng-model.
<html> <body ng-app="myApp"> <form:input path="Name" ng-model="uName"/> </body> </html> This is how my sample code looks like
try to use data-ng-model instead of ng-model. Let me know if this works
Do you use the spring form explicitly?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.