Liferay ERROR [RuntimePageImpl-16]不是有效的包含

时间:2016-06-14 09:32:25

标签: java jsp java-ee liferay

我正在努力使用doView()方法并从portlet.xml初始化参数。到目前为止,我一直在尝试的是,当我点击按钮或链接时,只需重定向到另一个视图。为此,我创建了两个JSP:

view.jsp的 vista2.jsp

我在portlet.xml中定义它们:

<portlet>
    <portlet-name>res-prot</portlet-name>
    <display-name>Res Prot</display-name>
    <portlet-class>com.test.ResProt</portlet-class>
    <init-param>
        <name>view-jsp</name>
        <value>html/resprot/view.jsp</value>
    </init-param>
    <init-param>
        <name>vista2-jsp</name>
        <value>/vista2.jsp</value>
    </init-param>   
    (...)

然后,我在init()方法中初始化它们:

String viewJSP;
String vista2JSP;

public void init() throws PortletException {
    viewJSP = getInitParameter("view-jsp");
    vista2JSP = getInitParameter("vista2-jsp");
}

最后,我调用doView()方法,该方法调用viewJSP,如果参数&#34; navegacion&#34;是空的:

@Override
    public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
        String destino = viewJSP;

        try {
            // we redirect only if "navegacion" is sent from the jsp
            if (renderRequest.getParameter("navegacion") != null){
                if(renderRequest.getParameter("navegacion").equalsIgnoreCase("vista2JSP")){
                    destino = vista2JSP;
                }
            }
            System.out.println("DESTINO: "+destino);
            include(destino, renderRequest, renderResponse);
        } catch (Exception e) {
            e.printStackTrace();

        }
    }

然后,在vista2.jsp中我只使用renderURL来做那个调用,但我甚至都没有到达那里。我收到此错误,portlet显示为空:

  

09:21:41,402 ERROR [RuntimePageImpl-16] [MVCPortlet:357]   html / resprot / view.jsp不是有效的包含

这就是这个脏项目的组织方式(请记住,这仅用于测试目的):

enter image description here

这里失败了什么?

编辑:

如果我按&#34; /&#34;开始路线,则会引发不同的错误:

  

DESTINO:/html/resprot/view.jsp java.lang.NullPointerException at at   com.liferay.portal.kernel.portlet.LiferayPortlet.isValidPath(LiferayPortlet.java:425)     在   com.liferay.portal.kernel.portlet.LiferayPortlet.checkPath(LiferayPortlet.java:193)     在   com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:360)     在   com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:378)     在com.test.ResProt.doView(ResProt.java:52)at   com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:235)     在   com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:314)     在javax.portlet.GenericPortlet.render(GenericPortlet.java:262)at   com.test.ResProt.render(ResProt.java:35)at   com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)     在   com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)     在   com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)     在   com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)     在   com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)     在   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)     在   org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)     在   org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543)     在   com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:583)     在   com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:656)     在   com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:362)     在   org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1239)     在org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at   com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)     在   com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)     在   com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)     在   com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:638)     在   com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:135)     在   com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)     在   com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)     在   com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer.access $ 4(PortletRenderer.java:107)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer $ PortletRendererCallable.doCall(PortletRenderer.java:180)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer $ PortletRendererCallable.doCall(PortletRenderer.java:1)     在   com.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   com.liferay.portal.kernel.concurrent.ThreadPoolExecutor $ WorkerTask._runTask(ThreadPoolExecutor.java:682)     在   com.liferay.portal.kernel.concurrent.ThreadPoolExecutor $ WorkerTask.run(ThreadPoolExecutor.java:593)     在java.lang.Thread.run(Thread.java:745)

编辑2:如果我移动&#34; view.jsp&#34;到根文件夹,不断抛出相同的错误:

  

DESTINO:/view.jsp java.lang.NullPointerException at   com.liferay.portal.kernel.portlet.LiferayPortlet.isValidPath(LiferayPortlet.java:425)     在   com.liferay.portal.kernel.portlet.LiferayPortlet.checkPath(LiferayPortlet.java:193)     在   com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:360)     在   com.liferay.util.bridges.mvc.MVCPortlet.include(MVCPortlet.java:378)     在com.test.ResProt.doView(ResProt.java:52)at   com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:235)     在   com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:314)     在javax.portlet.GenericPortlet.render(GenericPortlet.java:262)at   com.test.ResProt.render(ResProt.java:35)at   com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)     在   com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)     在   com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)     在   com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)     在   com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)     在   com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)     在   org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)     在   org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543)     在   com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:583)     在   com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:656)     在   com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:362)     在   org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1239)     在org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at   com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)     在   com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)     在   com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)     在   com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:638)     在   com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:135)     在   com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)     在   com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)     在   com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer.access $ 4(PortletRenderer.java:107)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer $ PortletRendererCallable.doCall(PortletRenderer.java:180)     在   com.liferay.portal.layoutconfiguration.util.PortletRenderer $ PortletRendererCallable.doCall(PortletRenderer.java:1)     在   com.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   com.liferay.portal.kernel.concurrent.ThreadPoolExecutor $ WorkerTask._runTask(ThreadPoolExecutor.java:682)     在   com.liferay.portal.kernel.concurrent.ThreadPoolExecutor $ WorkerTask.run(ThreadPoolExecutor.java:593)     在java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:1)

你应该替换

<value>html/resprot/view.jsp</value>

通过

<value>/html/resprot/view.jsp</value>