struts2.2.3.1 发布到tomcat7.0出现错误 20
严重:Exceptionstartingfilterstruts2java.lang.NoClassDefFoundError:org/apache/commons/la...
严重: Exception starting filter struts2
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:198)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
求高手帮忙解决 展开
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:198)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
求高手帮忙解决 展开
1个回答
展开全部
首先,struts2进行权限验证是用拦截器做的
一个简单的登录拦截器示例如下:
package com.zdf.interceptor;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.zdf.entity.Admin;
@SuppressWarnings("serial")
public class LoginInterceptor extends AbstractInterceptor{
@Override
public String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
Admin admin = (Admin)invocation.getInvocationContext().getSession().get("ADMIN");
if(admin!=null){
return invocation.invoke();
}else{
return Action.LOGIN;
}
}
}
一个简单的登录拦截器示例如下:
package com.zdf.interceptor;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.zdf.entity.Admin;
@SuppressWarnings("serial")
public class LoginInterceptor extends AbstractInterceptor{
@Override
public String intercept(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub
Admin admin = (Admin)invocation.getInvocationContext().getSession().get("ADMIN");
if(admin!=null){
return invocation.invoke();
}else{
return Action.LOGIN;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询