开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜