Spring boot web app with jsp error no mapping for GET

I am dealing with a problem

Here is my EmployeeController:

EmployeeController

package com.examenjsp.jsp.controllers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import com.examenjsp.jsp.jdbcConnect;


@Controller
@EnableWebMvc
@RequestMapping("/views") // Applies to all routes within this controller
public class EmployeeController {


    @GetMapping({"/", "/index"})
    public String showIndex(Model model) {
        String query = "SELECT * FROM employees";
        String url = "jdbc:mysql://localhost:3306/employeesdb";
        String name = "root";
        String password = "rootadmin223";
        String table = jdbcConnect.GetTable(query, url, name, password);
        model.addAttribute("employeeTable", table);
        return "index"; // 
    }


    @PostMapping("/action_page")
    public String addEmployee(
            @RequestParam("first_name") String firstName,
            @RequestParam("last_name") String lastName,
            @RequestParam("salary_pm") float salaryPm,
            @RequestParam("hire_date") String hireDate,
            @RequestParam("company") String company,
            @RequestParam("department") String department) {

        jdbcConnect.addValue(firstName, lastName, salaryPm, hireDate, company, department);
        return "redirect:/views/index"; // Redirects back to index after adding
    }


    @PostMapping("/edit_employee")
    public String editEmployee(@RequestParam("employee_id") int employeeId, Model model) {
        try {
            ResultSet rs = jdbcConnect.getValue(employeeId);
            if (rs != null && rs.next()) {
                model.addAttribute("employeeId", employeeId);
                model.addAttribute("firstName", rs.getString("first_name"));
                model.addAttribute("lastName", rs.getString("last_name"));
                model.addAttribute("salaryPm", rs.getFloat("salary_pm"));
                model.addAttribute("hireDate", rs.getString("hire_date"));
                model.addAttribute("company", rs.getString("company"));
                model.addAttribute("department", rs.getString("department"));
                return "edit_employee"; // Shows edit_employee.jsp
            } else {
                model.addAttribute("error", "Employee not found");
                return "error"; // Shows an error page if employee isn't found
            }
        } catch (SQLException e) {
            e.printStackTrace();
            model.addAttribute("error", "Error occurred while fetching employee details: " + e.getMessage());
            return "error"; // Shows an error page on SQL exceptions
        }
    }

    // PostMapping to update an employee's details
    @PostMapping("/update_employee")
    public String updateEmployee(
            @RequestParam("employee_id") int employeeId,
            @RequestParam("first_name") String firstName,
            @RequestParam("last_name") String lastName,
            @RequestParam("salary_pm") float salaryPm,
            @RequestParam("hire_date") String hireDate,
            @RequestParam("company") String company,
            @RequestParam("department") String department) {

        jdbcConnect.setValue(employeeId, firstName, lastName, salaryPm, hireDate, company, department);
        return "redirect:/views/index"; // Redirects back to index after updating
    }

    // PostMapping to delete an employee
    @PostMapping("/delete_employee")
    public String deleteEmployee(@RequestParam("employee_id") int employeeId) {
        jdbcConnect.dropValue(employeeId);
        return "redirect:/views/index"; // Redirects back to index after deleting
    }
}

and here is my ExamenJspSpringApplication:

ExamenJspSpringApplication

package com.examenjsp.jsp;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@EnableWebMvc
@SpringBootApplication()
@ComponentScan(basePackages = { "com.examenjsp.jsp", "com.examenjsp.jsp.configuration","com.examenjsp.jsp.controllers"}, excludeFilters = { @Filter(type = FilterType.ANNOTATION, value = Configuration.class) })

public class ExamenJspSpringApplication extends SpringBootServletInitializer{

    public static void main(String[] args) {
        SpringApplication.run(ExamenJspSpringApplication.class, args);
    }
    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http.authorizeRequests(authorizeRequests -> authorizeRequests.anyRequest()
          .permitAll())
          .csrf(AbstractHttpConfigurer::disable);
        return http.build();
    }
    
     
     
    
}

and here is my app structure:

The dependencies in my pom seem to be in place and my application.properties looks like this:

application.properties

spring.mvc.static-path-pattern=/WEB-INF/views/
spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.jsp
server.port=8082
spring.datasource.url=jdbc:mysql://localhost:3306/employeesdb
spring.datasource.username=root
spring.datasource.password=rootadmin223
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

What can I try to solve this?

6

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật