누구든지 HTML 속성의 객체를 Spring의 Java 클래스에 바인딩하는 방법을 설명 할 수 있습니까? 나는 웹 프레임 워크를 봄으로 초보자 다.Spring의 경로 속성
답변
짧은 이야기 경로 속성은 java beans 규칙을 사용하여 Java 속성에 바인딩됩니다. 다음과 같은 형식에 대한 예를 들면 다음과 같습니다의
public class Student {
private String name;
public String getName() { return this.name; }
public void setName(String name) { this.name = name; }
private boolean cool;
public boolean isCool() { return this.cool; }
public void setCool(boolean cool) { this.cool = cool; }
}
더 많은 정보 : 학생 클래스는 다음과 같은 속성으로 정의 된 경우
@RequestMapping(...)
public String updateStudent(@ModelAttribute("theStudent") Student student) {
// ...
}
자동 바인딩 : 컨트롤러 핸들러 방법에 따라
<form:form method="post" modelAttribute="theStudent">
Name: <form:input type="text" path="name"/>
Cool?: <form:input type"checkbox" path="cool"/>
<button>Save</button>
</form:form>
그리고 JavaBeans convenion은 section 8.3 of the specification document에 있습니다.
명령 객체는 어떻습니까? –
이것은 modelAttribute의 또 다른 구문입니다. 그래서'commandObject = "theStudent"는 같은 결과를 줄 것입니다. – gerrytan
안녕하세요, 당신이 commandName = "command"를 폼에 추가하지 않으면 작동하지 않습니다. – FrankelStein
- 1. Spring의 JBOSS AS7에서 속성 파일을 사용하려면 어떻게해야합니까?
- 2. 양식 태그의 경로 속성
- 3. Spring의 Thread.setDefaultUncaughtExceptionHandler
- 4. Spring의 ProxyFactoryBean
- 5. Spring의 java.net.BindException
- 6. Spring의 MessageInterpolator
- 7. Spring의 의존성 프로퍼티 값을 오버라이드
- 8. 유효성 검사 메시지가 Spring의 메시지 속성 파일에서 선택되지 않았습니다.
- 9. 컨텍스트의 기본 패키지 속성 : spring의 component-scan 태그 3
- 10. XAML에서 바인딩의 경로 속성 연결
- 11. 속성 파일에서 파일 경로 읽기
- 12. Ant 속성 파일의 절대 경로
- 13. 속성 설정 클래스 경로 넷빈즈
- 14. 석영과 함께 Spring의 LocalTaskExecutorThreadPool 사용하기
- 15. Spring의 Environment Abstraction은 PropertyEditors를 사용합니까?
- 16. Spring의 @Value 주석과 동일한 JSR-330이 있습니까?
- 17. Spring의 Dojo 캐싱 문제
- 18. 개행과 Spring의 SimpleUrlHandlerMapping
- 19. JPA와 Spring의 통합 테스트
- 20. @ModelAttribute 및 Spring의 @SessionAttribute
- 21. AngularJS와 Spring의 통합
- 22. Couchdb와 Spring의 통합
- 23. SPRING의 webServiceTemplate.sendSourceAndReceiveToResult에 WS
- 24. 정적 컨텍스트와 Spring의 관계
- 25. Struts와 Spring의 통합
- 26. Requestbody를 Spring의 JSONObject에 매핑하기
- 27. BeanPostProcessor로 Spring의 커스텀 어노테이션
- 28. EJB3와 Spring의 통합
- 29. Spring의 동적 Apache log4j
- 30. Spring의 다중 빈 인스턴스
"스프링 폼 태그"를 검색해보십시오. html 폼을 객체에 바인딩하는 스프링 속성이있는 html 태그처럼 보입니다. – Oneb
나는 유용한 정보가 없으므로 이해할 수 없으므로 Stack : –
참조 http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html –