Reputation: 1262
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:authentication property=/"principal.username/"/>" />
at value field I want to take username of logged in user. Please Help. Thank you in Advance.
Upvotes: 1
Views: 956
Reputation: 3858
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
Upvotes: 4