Spring使用安全性:身份验证主体.链接中的用户名



这个应该很简单

在标题中。JSPX文件我想有一个链接,将导致身份验证的用户到他们的用户页。

这是我用来检索用户名:

<sec:authentication property="principal.username" /> 

我想把它放在这里:

<a href="http://localhost:8080/dealclick/users/username_here" > My account </a>

有可能吗?

你试过了吗

<c:set var="username">
<sec:authentication property="principal.username" /> 
</c:set>

,然后使用

<a href="http://localhost:8080/dealclick/users/${username}" > My account </a>

您可以将其替换为:

<a href="http://localhost:8080/dealclick/users/<sec:authentication property="principal.username"/>" > My account </a>

最新更新