What's the proper way to create a hyperlink in Spring+JSP? There must be a better way than just coding in the <a href="...">
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:
<table>
<tr>
<td><a href="people.htm?sort=name">Name</a></td>
<td><a href="people.htm?sort=age">Age</a></td>
<td><a href="people.htm?sort=address">Address</a></td>
</tr>
...
This seems bad as the URL people.htm
is hardcoded in the JSP. There should be a way to have Spring automatically build the <a>
tag using the URL defined in servlet.xml
.
Edit: Maybe I should be using a Spring form.