上述&lt采用了棱角分明的js表单验证;形式:输入>标签 [英] Using angular js form validations in <form:input> tag

查看:161
本文介绍了上述&lt采用了棱角分明的js表单验证;形式:输入>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了具有弹性形式的JSP页面。我想验证采用了棱角分明的js形式。输入> 标签,我:形式;在&LT当我尝试添加的需要 NG-模型属性越来越例外碧玉例外等号预期属性NG-模型根据TLD 在该行无效的标签输入其中i添加这些属性。

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?

推荐答案

有4事情你可以试试:

第一个:也许最巧妙的,我想这应该工作:

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

第二个:忘掉角度验证,并使用Spring的验证方法。也许这是不是你正在寻找的东西。

Second one: Forget about Angular Validation, and use Spring Validation methods. Maybe this isn't the thing you're searching for.

第三个:是不是你有可能约忘记&LT;形式:输入&GT; 标签,并使用&LT;输入&GT; 标签呢?也许不是。

Third one: Isn't it possible for you to forget about <form:input> tags, and use <input> tags instead? Maybe not.

第四招:您可以试着给你的表单:输入标签的ID号,并在页面的底部,运行一个简单的jQuery脚本。我知道,这不是做最巧妙的事情,但也许它的工作原理。

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.

这篇关于上述&lt采用了棱角分明的js表单验证;形式:输入&GT;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆