title: Connect front-end with backend
body: <p>My controller is</p>
  
  <p>@RestController public class MainRestController {</p>
  
  <pre><code>@Autowired
  private EmployeeDAO employeeDAO;
  private final Logger logger = LoggerFactory.getLogger(MainRestController.class);
  
  @RequestMapping("/")
  public String newHome(Model Employee){
      return "newHome";
  }
  
  // call http://&lt;host&gt;/newHome.jspjsp or just http://&lt;host&gt;/hello
  /*
  @RequestMapping(value = "/home", method = RequestMethod.GET)
  public String newHome(Model employee) {
      employee.addAttribute("myObject", new MyObject("helloWorld"));
      return "newHome";
  }
  </code></pre>
  
  <p>*/
      @RequestMapping(value = "/employee", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
      public JSONObject getEmployees(){</p>
  
  <pre><code>    return employeeDAO.getAllEmployees();
  }
  
  @RequestMapping(value = "/employee/{empName}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE })
  
  public JSONObject getEmployee(@PathVariable("empName") String empName) {
      return employeeDAO.getEmployee(empName);
  }
  
  @RequestMapping(value = "/employee", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE})
  
  public Employee addEmployee(@RequestBody Employee emp) {
  
      return employeeDAO.addEmployee(emp);
  
  }
  
  @RequestMapping(value = "/employee", method = RequestMethod.PUT, produces = { MediaType.APPLICATION_JSON_VALUE})
  public Employee updateEmployee(@RequestBody Employee emp) {
  
      return employeeDAO.updateEmployee(emp);
  }
  
  @RequestMapping(value = "/employees/{empName}", method = RequestMethod.DELETE, produces = { MediaType.APPLICATION_JSON_VALUE })
  public void deleteEmployee(@PathVariable("empName") String empName) {
      employeeDAO.deleteEmployee(empName);
  }
  
  @RequestMapping(value = "/newHome", method = RequestMethod.GET)
  public Employee newEmployee(){
      Employee employee = new Employee();
      employee.setEmpName("newHome");
      return employee;
  } }
  </code></pre>
  
  <p>And my java file is:</p>
  
  <p>public class ReadExcelFileAndStore {</p>
  
  <pre><code>public List getTheFileAsObject(String filePath){
  
      List &lt;Employee&gt; employeeList = new ArrayList&lt;&gt;();
  
      try {
  
          FileInputStream file = new FileInputStream(new File(filePath));
  
          // Get the workbook instance for XLS file
          HSSFWorkbook workbook = new HSSFWorkbook(file);
  
          int numberOfSheets = workbook.getNumberOfSheets();
          //loop through each of the sheets
          for (int i = 0; i &lt; numberOfSheets; i++) {
  
              // Get first sheet from the workbook
              HSSFSheet sheet = workbook.getSheetAt(i);
  
              // Iterate through each rows from first sheet
              Iterator&lt;Row&gt; rowIterator = sheet.iterator();
              while (rowIterator.hasNext()) {
                  // Get Each Row
                  Row row = rowIterator.next();
  
                  //Leaving the first row alone as it is header
  
                  if (row.getRowNum() == 0)
                      continue;
  
                  // For each row, iterate through each columns
                  Iterator&lt;Cell&gt; cellIterator = row.cellIterator();
  
                  Employee employee = new Employee();
  
                  while (cellIterator.hasNext()) {
  
                      Cell cell = cellIterator.next();
  
                      int columnIndex = cell.getColumnIndex();
  
                      switch (columnIndex + 1) {
  
                          case 1:
                              employee.setEmpName(cell.getStringCellValue());
                              break;
                          case 2:
                              employee.setExtCode((int) cell.getNumericCellValue());
                              break;
                      }
                  }
                  employeeList.add(employee);
              }
          }
          file.close();
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
      return employeeList;
  } }
  </code></pre>
  
  <p>I followed some web on serving static content in controller and added required dependencies needed for JSP and tags included in JSP files. But still I colud not connect my front-end with my back-end even though I have JSP files to link. what should I need to add more so as to connect my front-end with the back-end. Please anyone knows share your answers. Thank you</p>