package jp.wicresoft.controller;

import java.util.List;

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import jp.wicresoft.impl.SearchImpl;
import jp.wicresoft.info.IndexViewInfo;
import jp.wicresoft.info.SkillSearchInfo;

@Controller
public class SearchController {

	@Autowired
	SearchImpl searchImpl;
	
	Logger logger = LoggerFactory.getLogger(NewController.class);
	
	@RequestMapping(value={"/search"})
	public String loadPage(Model model) {
		model.addAttribute("page", "search");
		model.addAttribute("skillSearchInfo", new SkillSearchInfo());
		model.addAttribute("skillOptions", searchImpl.getSkillNameList());
		return "search";
	}
	
	@RequestMapping(value={"/search_result"})
	public String loadPage(@Valid SkillSearchInfo skillSearchInfo, Model model) {
		logger.info("Search for: " + skillSearchInfo.getLsSkill());
		model.addAttribute("page", "search");
		
		Long condition = Long.parseLong(skillSearchInfo.getLsSkill());
		List<IndexViewInfo> indexViewInfos = searchImpl.getSearchResultBySkill(condition);
		if (!indexViewInfos.isEmpty()) {
			model.addAttribute("stuffMetas", indexViewInfos);
			model.addAttribute("category", "検索結果　");
			return "stuff_info";
		}
		model.addAttribute("skillSearchInfo", skillSearchInfo);
		model.addAttribute("skillOptions", searchImpl.getSkillNameList());
		
		return "search";
	}
}

@@ -1121,16 +1121,25 @@
 h%22);%0A%09%09%0A
+%09%09try %7B%0A%09
 %09%09Long c
@@ -1195,16 +1195,17 @@
 ill());%0A
+%09
 %09%09List%3CI
@@ -1283,16 +1283,17 @@
 ion);%0A%09%09
+%09
 if (!ind
@@ -1317,16 +1317,17 @@
 ty()) %7B%0A
+%09
 %09%09%09model
@@ -1371,16 +1371,17 @@
 Infos);%0A
+%09
 %09%09%09model
@@ -1419,16 +1419,17 @@
 %E3%80%80%22);%0A%09%09%09
+%09
 return %22
@@ -1441,16 +1441,79 @@
 _info%22;%0A
+%09%09%09%7D%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09logger.info(e.getMessage());%0A
 %09%09%7D%0A%09%09mo

Debug simple search page