2014-05-10 2 views
0

스프링 부트로 빌드 된 응용 프로그램의 태그를 사용하여 컨트롤러가 제공 한 값으로 양식을 채우려고합니다. index.jsp에서의스프링 부트가있는 스프링 MVC : 폼 태그 오류 - 동등한 기호가 필요합니다.

org.apache.jasper.JasperException: /WEB-INF/jsp/index.jsp (line: 52, column: 102) equal symbol expected 

관련 부분 : 나는 양식 필드에 맞게 클래스를 생성 한

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> 
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> 
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<!DOCTYPE html> 
<html lang="en"> 
    <head> 

    <title><spring:message code="title.main" /></title> 

    </head> 

    <body> 
    <%@include file="include/navbar.jsp" %> 

    <div class="container-fluid"> 
     <div class="row"> 
     <div class="col-sm-12 col-sm-offset-0 col-md-8 col-md-offset-2 main"> 
      <div class="panel panel-default"> 
       <div class="panel-body"> 
        <form:form method="get" id="indexForm" commandName="indexForm" action="<c:url value="index_search" />" role="form"> 
         <div class="row"> 
          <div class="col-xs-6"> 
           <div class="form-group"> 
            <label for="city_out"><spring:message code="label.index.0" /></label> 
            <input:input type="text" class="form-control" id="city_out" path="city_out" /> 
           </div> 
           <div class="form-group"> 
            <label for="city_in"><spring:message code="label.index.1" /></label> 
            <form:input type="text" class="form-control" id="city_in" path="city_in" /> 
           </div> 
           <div class="form-group"> 
            <label for="company"><spring:message code="label.index.2" /></label> 
            <form:input type="text" class="form-control" id="company" path="company" /> 
           </div> 
          </div> 
          <div class="col-xs-6"> 
           <div class="form-group"> 
            <label for="date0"><spring:message code="label.index.3" /></label> 
            <form:input type="datetime" class="form-control" placeholder="dd.MM.yyyy [HH:mm]" id="date0" path="date0" /> 
           </div> 
           <div class="form-group"> 
            <label for="date1"><spring:message code="label.index.4" /></label> 
            <form:input type="text" class="form-control" placeholder="dd.MM.yyyy [HH:mm]" id="date1" path="date1" /> 
           </div> 
           <div class="form-group" align="right"> 
            <br /> 
            <button type="submit" id="search_btn" data-loading-text="Loading..." class="btn btn-primary">Search</button> 
           </div> 
          </div> 
         </div> 
        </form:form> 

       </div> 
      </div> 
     </div> 
     </div> 
    </div> 

    </body> 
</html> 

:

public class IndexForm { 
    private String city_out; 
    private String city_in; 
    private String company; 
    private String date0; 
    private String date1; 
// getters, setters 
} 

을 그리고 주에서 빈을 생성하지만 오류가 발생 수업 (나는 그렇게 희망한다) :

@Configuration 
@EnableAutoConfiguration 
@ComponentScan 
public class Application extends SpringBootServletInitializer { 
    @Bean 
    public static IndexForm indexForm() { 
     return new IndexForm(); 
    } 

    @Override 
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 
     return application.sources(Application.class); 
    } 

    public static void main(String[] args) throws Exception { 
     SpringApplication.run(Application.class, args); 
    } 

} 
@RequestMapping("/index") 
public String index(@RequestParam(value="e", required=false) List<Integer> errors, Map<String, Object> model) { 
    model.put("indexForm", new IndexForm()); 
    if (errors != null) 
     model.put("errors", errors); 
    return "index"; 
} 

나는 내가 본 예에서 차이를 볼 수 없습니다, 그래서 누군가가 내 실수에서 지적 있다면 행복 할 것 : 03,210 컨트롤러는이 방법이 포함되어 있습니다.

답변

0

오. jsp 태그를 포함하여 다른 태그가 작동하지 않는 것 같습니다. 그래서,

action="index_search" 

에 대한

action="<c:url value="index_search" />" 

을 변경하고 오류없이 내 페이지를 받았다. "텍스트"이름 = "이름이"봄에

필요 = 입력 타입 -

0

어떤 초보자는 예를 들어, 일반 HTML로 가득 필드의 유효성을 검사하기 위해 필요 여부로 필드를함으로써 실수를 할 - 양식 : input path = "firstName"required .... required는 작동하지 않으므로 동일한 유형의 오류 "등호 예상"이 필요합니다.