我的Action 继承DispatchAction我想用spring 拦截器获取被拦截的方法名?现在得到的方法名总是execute,怎么得到action中真实的方法名啊?
解决方案 »
- thread pool问题
- 工作一年在上海能拿多少工资,Java开发
- 几道J2EE面试题目,哪位大师过来瞧瞧先...
- 请问JSF中HtmlData怎样捕获鼠标单击事件?
- Hibernate里面,如何取得新插入行的ID值?
- WebSphere和WebLogic,应该选择哪一个?
- String.split怎么将"123 456 789"分割成"123"和"456 789"
- 怎样用java编写一个杨辉三角形
- JSP数据库编程环境搭建问题---急救---我给出100分
- 在weblogic 7.0中发布web.war时出现如下异常,不知为何?
- 怎样用Servletcontext计算一个网页的访问人数
- Java门外汉提问
<property name="beanNames">
<list><value>/customAction</value></list>
</property>
<property name="interceptorNames">
<list><value>authorCustomInter</value></list>
</property>
</bean>
<bean id="authorCustomInter" class="com.psit.struts.action.AuthorityCustomInterceptor"/>
写一个基类继承DispatchAction,重写execute方法,在里面加入你的权限判断逻辑。
另外还可以考虑在别的地方拦截啊
另外还可以考虑在别的地方拦截啊
[/Quote]简单的说就是我有一个action它继承DispatchAction 里面有对客户资料的增,删,改方法,现在我就想在执行增,删,改方法之前判断该用户是否有这个权限?
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (isRoleAllow(request)) {
return super.execute(......);
} else {
返回权限出错页面或抛出异常等。
}
}
//检查权限
protected boolean isRoleAllow(HttpServletRequest request) {
String method = request.getParamenter(你配置的参数名称);
////if ("save".equals(method)) {//假设save是添加}
////if ("delete".equals(method)) {//假设delete是删除} 读你的权限表判断当前用户有没有权限返回true或false不就行了
return ...
}
}
spring securetiy可以吗?