Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 表单spring mvc中的表单验证错误_Java_Spring Mvc_Model View Controller_Jsp Tags - Fatal编程技术网

Java 表单spring mvc中的表单验证错误

Java 表单spring mvc中的表单验证错误,java,spring-mvc,model-view-controller,jsp-tags,Java,Spring Mvc,Model View Controller,Jsp Tags,我试图在每个字段旁边打印表单验证。我的jsp文件看起来像 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-

我试图在每个字段旁边打印表单验证。我的jsp文件看起来像

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
   <head>
      <style>
         .error {
         color: red; font-weight: bold;
         }
      </style>
      <title>
         FORM
      </title>

   </head>
   <body>
      <div id="wrap" >
         <div  class= "container" style="min-height:400px;">

            <hr>
            <form:errors path="applicant.applicant_email" cssClass="error"/>
            <form:form method = "post" action = "${pageContext.request.contextPath}/addApplicant" modelAttribute = "applicant">

               <form:errors path="applicant.applicant_email" cssClass="error"/>
               <div class="form-group col-lg-4 col-md-4 col-sm-6">
                  <label>Email</label>
                  <input name = "applicant_email" class="form-control" id="inputEmail" placeholder="Email">
               </div>
               <div class="form-group col-lg-4 col-md-4 col-sm-6 ">
                  <input type = "submit" />
               </div>
            </form:form>
         </div>
      </div>
      <!-- div Wrap ka End -->
      <hr>
      <br>
      <br>
   </body>
</html>

.错误{
颜色:红色;字体大小:粗体;
}
形式

电子邮件


“申请人”是我的模范班的名字


现在,它可以在表单外部很好地打印,但如果表单:错误在表单:表单标记内部使用,则不会打印任何内容。我错过了什么。非常感谢您的帮助。谢谢。

我知道问题出在哪里了。所要做的就是向输入字段添加路径属性。比如我的例子:

<input name = "applicant_email" class="form-control" id="inputEmail" placeholder="Email" path = "applicant_email">

我猜问题出在哪里。所要做的就是向输入字段添加路径属性。比如我的例子:

<input name = "applicant_email" class="form-control" id="inputEmail" placeholder="Email" path = "applicant_email">