Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring using security:authentication principal.username in link

Ok this should be an easy one

In the header.jspx file i would like to have a link that will lead the authenticated user to their userpage.

This is what i am using to retrieve the username:

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

This is what i want to put it in:

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

Is it possible to do?

like image 529
adam2510 Avatar asked Aug 17 '26 02:08

adam2510


1 Answers

have you tried

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

and then use

<a href="http://localhost:8080/dealclick/users/${username}" > My account </a>
like image 197
maxb Avatar answered Aug 18 '26 18:08

maxb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!