Struts 中路径问题,问题解决马上结帖!

傻根她弟 2006-01-05 04:28:33
我的首页面本来没问题的,可是加上Filter以后图片跟CSS就找不到了

这是怎么回事啊?怎么解决?
web.xml文件配置如下

<filter>
<filter-name>checkuserfilter</filter-name>
<filter-class>ctpp.com.filter.CheckUserFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>checkuserfilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
...全文
202 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
llike_1983 2006-01-09
  • 打赏
  • 举报
回复
因为你的filter把图片和css也过滤掉了.你把你的图片和css放到过滤路径以外就可以了
傻根她弟 2006-01-09
  • 打赏
  • 举报
回复
哈哈,谢谢楼上,今天问题刚解决,llike_1983说的没错。
同样感谢,结帖!
wylsx 2006-01-08
  • 打赏
  • 举报
回复
bang帮顶
傻根她弟 2006-01-08
  • 打赏
  • 举报
回复
源文件的路径没问题!

愁死我了,真不知道问题出在哪了
傻根她弟 2006-01-07
  • 打赏
  • 举报
回复
怎么没人知道吗?
devie 2006-01-07
  • 打赏
  • 举报
回复
通过查看源文件看看路径发生了哪些变化
傻根她弟 2006-01-06
  • 打赏
  • 举报
回复
没有人知道怎么解决吗?
傻根她弟 2006-01-06
  • 打赏
  • 举报
回复
这是我的代码

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class CheckUserFilter extends HttpServlet implements Filter {
private FilterConfig filterConfig = null;;
//Handle the passed-in FilterConfig
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}

//Process the request/response pair
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) {
try {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
String StrURI = httpRequest.getRequestURI().toUpperCase();
boolean isVisite = true;
if (
( StrURI.indexOf("WELCOME.JSP") == -1 ) &&
( StrURI.indexOf("REGDIT.DO") == -1 ) &&
( StrURI.indexOf("LOGINACTION.DO") == -1 ) &&
( httpRequest.getSession().getAttribute("userName") == null )
){
isVisite = false;
}
if ( isVisite ){
filterChain.doFilter(request, response);
}
else{
httpResponse.sendRedirect("welcome.jsp");
}

} catch (ServletException sx) {
filterConfig.getServletContext().log(sx.getMessage());
} catch (IOException iox) {
filterConfig.getServletContext().log(iox.getMessage());
}
}

//Clean up resources
public void destroy() {
this.filterConfig = null;
}
}
devie 2006-01-06
  • 打赏
  • 举报
回复
这应该不是简单的路径问题,应该是你在filter处理后,路经发生了改变,仔细检查一下。或者把代码贴出来,大家帮你看一下。简单易说别人不好判断
傻根她弟 2006-01-05
  • 打赏
  • 举报
回复
我先作的页面,然后加的filter,原来是没问题的,加了filter就出问题了,图片显示不出来,样式层叠表也找不到了,好像是路径变了
King_Style 2006-01-05
  • 打赏
  • 举报
回复
描述具体些
King_Style 2006-01-05
  • 打赏
  • 举报
回复
这个跟Filter没有关系吧
傻根她弟 2006-01-05
  • 打赏
  • 举报
回复
检测用户是否合法
Marcus-Z 2006-01-05
  • 打赏
  • 举报
回复
你的filter是做什么用的

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧