spring使用安全性:在链接中验证principal.username

ada*_*510 3 java jsp spring-mvc spring-security

好的,这应该是一个简单的

在header.jspx文件中,我希望有一个链接,将经过身份验证的用户引导到他们的用户页面.

这是我用来检索用户名的:

<sec:authentication property="principal.username" /> 
Run Code Online (Sandbox Code Playgroud)

这就是我想要的内容:

<a href="http://localhost:8080/dealclick/users/username_here" > My account </a>
Run Code Online (Sandbox Code Playgroud)

有可能吗?

max*_*axb 5

你有没有尝试过

<c:set var="username">
<sec:authentication property="principal.username" /> 
</c:set>
Run Code Online (Sandbox Code Playgroud)

然后使用

<a href="http://localhost:8080/dealclick/users/${username}" > My account </a>
Run Code Online (Sandbox Code Playgroud)