日期:2014-05-19 浏览次数:20670 次
<action name="queryh" class="cn.com.norm.web.action.QueryAction" method="queryByHttp">
<result type="json" />
</action>
String getName = ServletActionContext.getActionMapping().getName();
System.out.println("-----getName----->>"+getName);
package cn.com.faqm.tool;
import java.io.IOException;
import javax.servlet.*;
import org.apache.struts2.ServletActionContext;
public class OpFilter implements Filter {
protected FilterConfig filterConfig;
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterchain) throws IOException, ServletException {
if(servletRequest.getParameter("actId") != null && !servletRequest.getParameter("actId").equals("")){
String getName = ServletActionContext.getActionMapping().getName();
System.out.println("-----getName----->>"+getName);
}
filterchain.doFilter(servletRequest, servletResponse);
}
public void destroy() {
this.filterConfig = null;
}
}
2012-12-12 15:00:19 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
at org.apache.struts2.ServletActionContext.getActionMapping(ServletActionContext.java:85)
&nb