我试图在我的自定义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嵌入的任何见解,我已经尝试过this blog的建议,但没有帮助。
有任何建议或方法可以实现这一目标吗?
我想有一些问题需要获得正确的portlet首选项和权限,以便在目标portlet上添加一个portlet。
如果您找到问题的解决方案,请更新。