-
카테고리
-
세부 분야
백엔드
-
해결 여부
해결됨
강의 다 듣고 혼자 하는중인데 도저히 이해가 안가서 여쭤봅니다..
23.07.06 17:40 작성 조회수 318
0
<tr th:each="festival : ${festivalList}">
<td><a th:href="@{/festival/one(param=${festival})}" th:text="${festival.name}"></a> </td>
뷰 단에서 fetivalList을 보여줍니다. 그리고 리스트에서 each문 돌면서 모두 잘보여줍니다. 그리고 festival을 다시 쓸일이 있어서 url에 담아서 컨트롤러로 넘어가면 못받습니다.
for문 뿐 아니라 객체 하나만 있는 상황에서도 안넘어가요
@GetMapping("/festival/one/search")
public String searchFestivalOne(@ModelAttribute("param") Festival festival, Model model) throws IOException {
System.out.println(festival.getName());
String[][] searchList = festivalService.jsonToList(festival.getName());
model.addAttribute(searchList);
model.addAttribute(festival.getName());
return "/festival/festival_search.html";
}
festival모델에 생성자문제라 생각해서 어노테이션 각각적용해서 모든 케이스 다해봤는데도 안되네요.. 에러는 안뜨고 그냥 null값만 나옵니다.
타임리프에서 festival.(변수) 는 모두 잘넘어가는데 festival 만넘기면 바인딩처리가 안됩니다.
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Festival {
@Id
private long id;
private String name; //축제명
private String location; //개최장소
private String startDate ;//축제시작일자
private String endDate ; //축제종료일자
private String content ; //축제내용
private String org ; //주관기관
private String open_org; //주최기관
private String sponsor; //후원기관
private String phone_num; //전화번호
private String homepage; //홈페이지주소
private String etc; //관련정보
private String location1; //소재지도로명주소
private String location2; //소재지지번주소
}
답변을 작성해보세요.
답변 1