在jsp中渲染图像的问题

时间:2012-11-23 15:05:50

标签: html jsp jeditorpane image-rendering

我无法在jsp中渲染图像。其他一切工作正常,即所有数据都被渲染。它只是导致问题的图像。我知道路径是正确的

<img src="https://localhost/genesis/images/client-logo1.png" alt="Image not available">

<img src="/images/client-logo1.png" alt="Image not available">

以下代码呈现jsp

HttpServletResponse charResponse = null;
     Locale locale = ProxyContextHolder.getProxyContext().getLocale();
    try {
        View view = jspViewResolver.resolveViewName(viewNameWithExtension , locale);
        StringWriter sw = new StringWriter();
        Object request = (ProxyContextHolder.getProxyContext()).getRequest();
        Object response = (ProxyContextHolder.getProxyContext()).getResponse();
        if (request != null &&  request instanceof HttpServletRequest
            && response != null &&  response instanceof HttpServletResponse) {
            HttpServletRequest httpReq = (HttpServletRequest) request;
            HttpServletResponse httpResp = (HttpServletResponse) response;
            charResponse = new CharResponseWrapper(httpResp);
            view.render(modelMap, httpReq, charResponse);
            html = charResponse.toString();
            //httpReq.getRequestDispatcher(viewNameWithExtension).include(httpReq, charResponse);
           // html = charResponse.toString();
        }
    }

我尝试了一些方法,但似乎没有任何工作。 将jsp加载到jeditorPane中,并从中创建图像。

在最大值,我可以看到某种破碎或未经渲染的图像,有太阳和山......不确定它是什么

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

/ image前缀是否由您为jsp列出的代码解析?我认为应该单独留下......