我正在使用Liferay和struts 2框架。我想要顯示一個jpg文件。jpg不顯示在liferay jsp頁面
我struts.xml中是這樣的:
<action name="searchAllCategoryWiseGraphical" class="com.stp.portal.view.SearchEFormReportPortlet" method="searchAllEFormsCategoryWiseGraphical" >
<result name="success">/WEB-INF/view/GraphicalViewPage.html</result>
</action>
現在產生條形圖,並保存在jpg格式的指定位置。我正在寫簡單的html代碼來顯示相同的:
<%@page import="com.liferay.portal.kernel.search.Document"%>
<%@page import="org.codehaus.groovy.transform.powerassert.Value"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<jsp:include page="/WEB-INF/view/MessagePage.jsp"/>
<html>
<head>
<title>Title</title>
</head>
<s:form name="searchAllCategoryWiseGraphical" action="searchAllCategoryWiseGraphical" method="POST" theme="simple">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<img border="0" src="D:/eFormReport_Vertical.jpg" alt="report" width="600" height="400">
</body>
</html>
</s:form>
</body>
</html>
但圖像不顯示。如果我將html代碼保存在單獨的html文件中(不在liferay門戶頁面中),則會顯示該圖形。它是一些liferay問題還是我失去了一些東西?
感謝和問候
------------ ----------- EDITED
感謝您的答覆。是的,它是一個路徑問題。現在解決了。現在我又遇到了另一個問題。圖表將根據輸入值而變化。但它只顯示第一個圖。我用保留相同文件名的新的jpg替換了舊的jpg。但它沒有顯示最新的jpg。
這是一個路徑問題。嘗試使用相對路徑而不是絕對物理路徑。 – Godinall
看到我的更新答案..如果該答案解決了您的圖像路徑問題,然後接受答案,並提出新的問題, –