// 1. Import necessary Spring framework classes
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
// 2. Create a controller class
@Controller
public class MyController {
// 3. Define a method to handle the GET request
@GetMapping("/myPath")
public String myHandler(Model model) {
// 4. Add data to the model if needed
model.addAttribute("key", "value");
// 5. Return the name of the view or template
return "myTemplate";
}
}