Example #1
0
 @RequestMapping(value = "/data.htm", method = RequestMethod.GET)
 public String loadSearchSuggestions(
     ModelMap map,
     @RequestParam(value = "data") String finData,
     @RequestParam(value = "cat") String searchBy,
     @RequestParam(value = "id") String searchId) {
   if (searchId.equals("searchUser")) {
     List<User> users;
     if (searchBy.equals("Name")) {
       users = userService.searchUser("fullName", finData);
     } else if (searchBy.equals("Address")) {
       users = userService.searchUser("homeAddress", finData);
       map.put("flag", "address");
     } else {
       users = null;
       map.put("flag", "hideSug");
     }
     map.put("userList", users);
   } else {
     List<Org> orgs = orgService.findOrg("orgName", finData);
     map.put("flag", "org");
     map.put("orgList", orgs);
   }
   return "searchSuggestions";
 }
Example #2
0
 @RequestMapping(value = "/viewResult.htm")
 public String loadresult(
     ModelMap map,
     @RequestParam(value = "searchID") String searchID,
     @RequestParam(value = "finData") String finData) {
   if (searchID.equals("searchUser")) {
     try {
       User user = userService.findUser("fullName", finData).get(0);
       map.put("user", user);
     } catch (Exception e) {
       map.put("flag", "notFound");
     }
   } else {
     try {
       Org org = orgService.findOrg("orgName", finData).get(0);
       map.put("org", org);
     } catch (Exception e) {
       map.put("flag", "notFound");
     }
   }
   return "resultForm";
 }