我无法在 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 中,并从中创建图像。
我最多只能看到一些带有太阳和山脉的破碎或未渲染的图像......不确定它是什么
有人可以帮我解决这个问题吗?