66191

Using angular js form validations in tag

Question:

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.

Recommend

  • Which folder of a web application war should jasperreports.properties be located?
  • Jasper Server: passing argument to get report data for customer
  • Run jasper report (created with iReport) from within python without jasperserver?
  • jasper reports page break increases blank space at bottom
  • How can I pass complex expression to parametrized active pattern?
  • Installing ocropus-0.4.4
  • How to escape colon (:) character while executing native SQL queries against an Informix database us
  • reduce/reduce conflicts using ocamlyacc
  • How to write string.Contains(someText) in expression Tree
  • How to get the index of element in the List in c#
  • Rails AREL .where statement
  • INSERT EXEC Statement cannot be nested [duplicate]
  • Get used tables from sql query [duplicate]
  • Function calls are not supported. Consider replacing the function or lambda with a reference to an e
  • pillow imaging ImportError
  • RxJava debounce by arbitrary value
  • How to revert to previous XCode version?
  • onBackPressed() not being executed
  • How to define and use opencv mat of user type
  • PHP buffered output depending on server setting?
  • Functions in global context
  • Get one-time binding to work for ng-if
  • Volley JsonObjectRequest send headers in GET Request
  • Is possible to count alias result on mysql
  • Check if a string to interpolate provides expected placeholders
  • javascript inside java/jsp code
  • Cassandra Data Model
  • ActionScript 2 vs ActionScript 3 performance
  • Importing jscolor library in angular 2
  • Android Studio and gradle
  • Why joiner is not used after Sequence generator or Update statergy
  • Getting Messege Twice Using IMvxMessenger
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Python/Django TangoWithDjango Models and Databases