What's the proper way to create a hyperlink in Spring+JSP? There must be a better way than just coding in the tag. Take for example a page that displays people. The URL is people.htm. The corresponding controller gets people from the database and performs optional column sorting. The JSP might look like:
Name | Age | Address |
...
This seems bad as the URL people.htm is hardcoded in the JSP. There should be a way to have Spring automatically build the tag using the URL defined in servlet.xml.
Edit: Maybe I should be using a Spring form.
解决方案
The only thing that comes to mind is the JSTL standard tag . For example:
Now this won't get you servlet mapping or the like but nothing will. It's not something you could really do programmatically (after all, a servlet can and usually does map to a range of URLs). But this will take care of escaping for you.