簡體   English   中英

在jsp中渲染圖像的問題

[英]issues with rendering image in jsp

我無法在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中,並從中創建圖像。

在最大程度上,我可以看到帶有太陽和山脈的某種破碎或未渲染的圖像……不確定是什么

有人可以幫我這個忙嗎?

/ image前綴是否由您為jsp列出的代碼解析? 我認為應該讓它單獨...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM