Java – spring using security: authentication principal in the link username

OK, this should be a simple one

In the header In the JSP x file, I want a link to guide authenticated users to their user pages

This is what I use to retrieve the user name:

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

That's what I want:

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

Is it possible?

Solution

Have you ever tried

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

Then use

<a href="http://localhost:8080/dealclick/users/${username}" > My account </a>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>