已经在xml中做了如下配置,可是当我要访问action中的某个方法时却不能拦截,报404错误,迷茫的很
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>
你做文件上传非要用FCK?
比如说,现在我一个action到一个jsp, action名字和jsp名字和action方法名一样就这么设计
<action name="*" class="" method="{1}">
<result>/{1}.jsp</result>这样.! 具体怎么你自己照这个模式去套
已经在xml中做了如下配置,可是当我要访问action中的某个方法时却不能拦截,报404错误,迷茫的很
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
if("/fckeditor/editor/filemanager/connectors".equals(request.getServletPath())){
chain.doFilter(req, res);
}else{
super.doFilter(req, res, chain);
}
}
<!-- struts2配置 -->
<filter>
<filter-name>struts2</filter-name>
<!-- 使用继承FilterDispatcher的过滤器 -->
<filter-class>yourFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!-- FCKeditor 配置 -->
<servlet>
<servlet-name>ConnectorServlet</servlet-name>
<servlet-class>
mah.blog.fckeditor.ConnectorServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>ConnectorServlet</servlet-name>
<url-pattern>
/fckeditor/editor/filemanager/connectors/*
</url-pattern>
</servlet-mapping>
存放图片的位置在项目下只要项目重启图片就会丢了!这应该怎么解决!