彩票走势图

彩票走势图 > 慧问 > 频道

ChartDirector用了jsp过滤器后不出图

发表于2020-05-26 回复:1 查看:3710  |  

一、jsp代码

String chart1URL = c.makeSession(request, "chart1");

<img src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'   usemap="#map1" border="0">

二、过滤器代码

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

HttpServletRequest req=(HttpServletRequest)request;

HttpServletResponse resp=(HttpServletResponse)response;

HttpSession session=req.getSession(true);

resp.setContentType("text/html");

resp.setCharacterEncoding("UTF-8");

PrintWriter out=resp.getWriter();

String request_uri=req.getRequestURI();

String ctxPath=req.getContextPath();

String uri=request_uri.substring(ctxPath.length());

if(uri.contains("Login.jsp")||uri.contains("Login")||uri.contains("getchart")||uri.contains(".png")||uri.contains(".jpg")||uri.contains(".css")||uri.contains(".js")||uri.contains("testchart.jsp")) {

chain.doFilter(request, response);

}else {

if(null !=session.getAttribute("user")) {

chain.doFilter(request, response);

}else {

out.println("您还没有登录,请先登录!3秒后回到登录页面。");

resp.setHeader("refresh","3;url="+ctxPath+"/Login.jsp");

return;

}

}

}

三、问题

无过滤器,显示正常,上了过滤器后网页不出图。


0个回答

打破零回复...

回复

登录 慧都网发表评论

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP