我正在尝试在我的自定义 portlet 中嵌入日历 portlet。但无法做到这一点。我收到以下错误:
javax.servlet.ServletException: javax.servlet.jsp.JspException:
ServletException in '/html/common/themes/portlet.jsp':
File "/html/common/themes/portlet.jsp" not found
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
这是我的课:
public class Hello extends MVCPortlet {
public void doView(RenderRequest request, RenderResponse response)
throws IOException, PortletException {
final String portletId = "47"; //hello world portlet id
final ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
HttpServletRequest req = PortalUtil.getHttpServletRequest(request);
HttpServletResponse res = (HttpServletResponse) request.getAttribute(PortletServlet.PORTLET_SERVLET_RESPONSE);
ServletContext servletContext = req.getSession().getServletContext();
PortletPreferences prefs = null;
try {
// get the portlet preferences
prefs = PortletPreferencesFactoryUtil.getPortletPreferences(req, portletId);
} catch (PortalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("portlet preferences are " + prefs.toString());
//method 3
PortletPreferences originalPrefs = null;
try {
originalPrefs = PortletPreferencesFactoryUtil.getStrictLayoutPortletSetup(
themeDisplay.getLayout(), portletId);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PortletPreferences targetPrefs = null;
try {
targetPrefs = PortletPreferencesFactoryUtil.getStrictLayoutPortletSetup(
themeDisplay.getLayout(), portletId);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (java.util.Map.Entry<String, String[]> entry : targetPrefs.getMap().entrySet()) {
targetPrefs.reset(entry.getKey());
}
for (java.util.Map.Entry<String, String[]> entry : originalPrefs.getMap().entrySet()) {
targetPrefs.setValues(entry.getKey(), entry.getValue());
}
// Store preferencec.
targetPrefs.store();
try {
//finally render the portlet
final String portletHtml = RuntimePortletEmbedUtil.renderPortlet(request, response, portletId, "");
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
关于 portlet 嵌入的任何见解,我已经尝试过处理此博客中的建议,但没有任何帮助。
有什么建议或方法可以做到这一点?
我猜想获得正确的 portlet 首选项和在目标 portlet 上添加 portlet 的权限存在问题。
如果您找到问题的一些解决方案,请更新。