Challenge: Spring MVC Fundamentals
Test your understanding of Spring MVC by implementing a web interface for a Pet Adoption application.
We'll cover the following
Problem statement
Assume you have an existing Spring application for a Pet Adoption system. Your task is to build the web interface for this application using Spring MVC. Specifically, you'll need to:
Implement a controller with methods to handle requests for viewing web pages.
Implement JSP files to provide the necessary views for the requests.
Utilize the HTTP requests to handle data.
Note: You will be working within a pre-configured Spring framework, including DispatcherServlet, so your focus should be on the web interface and interaction with the service layer.
Requirements
To successfully complete this challenge, you need to:
Implement an
ApplicationController
to display a main menu with links to available functionalities.Implement a
PetController
class with following methods:Show a form for searching pets by name
Display pet details based on the search
Develop JSP files for following web pages:
The
main-menu
: To show all the available features.The
get-pet-form
: To search for pets using their names.The
pet-details
: To display the information associated with a pet.
Use:
@RequestParam
for passing parameters in HTTP requestsHTML forms to capture user input
Models to pass data between the controller and the view
The PetService
class is already implemented to handle business logic and interaction with the data layer.
Try it yourself
Use the following code widget to implement your solution.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.