random_programmer
random_programmer

Reputation: 21

jsp request to controller isn't processing

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

controller will read the id @param to render the appropriate quiz

But instead clicking a picture only gets this error page

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?

Controller

Upvotes: 0

Views: 29

Answers (1)

seenukarthi
seenukarthi

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

Related Questions