Reputation: 21
I'm building a little application where the user can click on one of three pictures to link to a quiz on a topic corresponding to that picture. When clicking a picture, it is supposed to forward the request to a Spring controller
But instead clicking a picture only gets this error page
And here is controller code, just simply testing to try to see if the request is received correctly. Evidently it's not. I'm not sure what is the problem here, is it with the Mapping?
Upvotes: 0
Views: 29
Reputation: 8682
The issue is in your link. You have <a href="/quiz?id"
which load the path http://localhost:8080/quiz?id=2
ignoring the application's context path.
You must add the context path to the link as <a href="${pageContext.request.contextPath}/quiz?id"
so when the link is clicked it will load the controller in your application.
Upvotes: 1