开发者

How to set value from<security:authentication/> to the parameter with <c:set>

开发者 https://www.devze.com 2023-04-04 06:08 出处:网络
I have a problem in my jsp page. I use Spring security and I need to get a name of the authentificated user, for this I use the next tag

I have a problem in my jsp page. I use Spring security and I need to get a name of the authentificated user, for this I use the next tag

 <security:authentication property="name" />

I need to compare this value with other String, how can I do this? I thought I can set this value to some parameter like

<c:set var="userName" value="<security:authentication property='name'/>"scope="page" /&g开发者_JS百科t;

and then to compare my values

<c:when test="${(params.userSelect.login eq pageScope.userName)}">

but this doesn't work. I get the name from <security:authentication property="name" /> (I can view it on jsp page), but I can't compare this values.


c:set can take the content of the body in as the value.

<c:set var="userName"><security:authentication property="name" /></c:set>
0

精彩评论

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

关注公众号