how to take username using security:authentication tag in Spring?
I am new to spring. I want send username of logged in user to my controller. I tried following code which is not working...
<form:input path="bidderName" value="<security:au开发者_开发问答thentication property=/"principal.username/"/>" />
at value field I want to take username of logged in user. Please Help. Thank you in Advance.
You don't need to send it to your Spring Controller. You can actually access it directly from there.
SecurityContextHolder.getContext().getAuthentication().getName();
It seems you're trying to pass the logged-in user from a JSP form back to your controller
精彩评论