0
我試圖按照本教程運行我的第一個Portlet: Liferay Developers GuideLiferay的 - 簡單的portlet問題
我使用Liferay的6.0.6版本,這是我的代碼。
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ page import="javax.portlet.PortletPreferences" %>
<portlet:defineObjects />
<liferay-theme:defineObjects />
<%
PortletPreferences prefs = renderRequest.getPreferences();
String greeting = (String)prefs.getValue(
"greeting", "Hello! Welcome to our portal.");
%>
<p><%= greeting %></p>
<portlet:renderURL var="editGreetingURL">
<portlet:param name="jspPage" value="/edit.jsp" />
</portlet:renderURL>
<p><a href="<%= editGreetingURL %>">Edit greeting</a></p>
當我嘗試運行我得到錯誤信息:
org.apache.jasper.JasperException: An exception occurred processing JSP page /view.jsp at line 8
5: <portlet:defineObjects />
6: <liferay-theme:defineObjects />
7: <%
8: PortletPreferences prefs = renderRequest.getPreferences();
9: String greeting = (String)prefs.getValue("greeting", "Hello! Welcome to our portal!");
10: %>
11: <p><%= greeting %></p>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:110)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:53)
有任何人有什麼我做錯了什麼想法?
IMO你最好從任何通用的portlet教程的學習,然後將其調整到Liferay。 liferay教程的例子給出了使用相當過時的技術(scriptlets任何人?)。 反正你的代碼爲我工作。所以也許嘗試重新部署它。 – soulcheck
正如soulcheck已經指出的那樣。不要浪費你的時間在liferay特定的portlet上。堅持JSR 286 portlet。使用像Spring MVC或JSF實現更像樣的東西。 –
那麼,如果他們使用的Liferay爲特定原因,門戶服務器完全取決於。如果他們只是在學習如何開發portlet,我會與你的陳述一致,但如果他的學習Liferay的Portlet開發,那麼這是一種關鍵的! – Jonny