【发布时间】:2012-02-11 05:47:01
【问题描述】:
我有一个带有@Secured({"ROLE_ADMIN"}) 的struts2 操作来保护执行方法。在执行方法中,我将消息分配给操作的成员变量,然后返回 SUCCESS 并最终出现在 jsp 页面上。在页面上,我使用<sproperty> 检索操作成员变量。
private String greeting;
public String execute() throws Exception {
this.greeting="Hello";
return SUCCESS;
}
// getters and setters for greeting
...
<s:property value="greeting" />
问题是当安全注释存在时,jsp 不会显示任何成员变量,但是当 @Secured 被删除时,整个事情会正常运行并显示设置到成员变量中的消息。
看起来实际的安全性工作正常,但是当通过注释启用时,成员变量(或者可能是操作的实例)没有进入值堆栈。
我看不到任何错误消息。
【问题讨论】:
-
我没有在 S2 应用程序中使用 Spring Security,但是属性标签会调用
getGreeting(),是否也应该注释?如果是这样,可能要考虑ModelDriven。
标签: java struts spring-security