Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
126
rated 0 times [  129] [ 3]  / answers: 1 / hits: 31567  / 10 Years ago, wed, june 25, 2014, 12:00:00

I have a jsp page called reports.jsp and I have displayed the links in the view for a user to click.
How can I invoke Spring controller method by clicking on the link that will pass an argument.


More From » java

 Answers
4

You have to use @PathVariable in order to do this. Example:



Jsp:



<a href=<c:url value=/test/${object.argument} /> >hello</a>


Controller:



@RequestMapping(value = /test/{argument}, method = RequestMethod.GET)
public String Controller(@PathVariable(argument) String argument) {
...
}

[#70442] Monday, June 23, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dylondaytond

Total Points: 92
Total Questions: 88
Total Answers: 96

Location: China
Member since Fri, Jan 15, 2021
3 Years ago
dylondaytond questions
Tue, Jun 22, 21, 00:00, 3 Years ago
Thu, May 7, 20, 00:00, 4 Years ago
;