-1

Hi Iam building a MVCPortlet on liferay . I use a view.jsp that point to two other jsp pages using renderURL but whenever i click on one of the two link i experience an Exception in eclipse console.

here is the code of the view.jsp of the portlet

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

<portlet:defineObjects />

<!--<jsp:include page="addNewWebSite.jsp" /> -->

<portlet:renderURL var="addNewWebSite">
    <portlet:param name="jspPage" value="/addNewWebSite.jsp"/>
</portlet:renderURL>
<portlet:renderURL var="listWebSites">
    <portlet:param name="jspPage" value="/listWebSites.jsp"/>
</portlet:renderURL>
<ul>
<li><a href="<%=addNewWebSite%>">Add new web site</a></li>
<li><a href="<%=listWebSites %>">List Web Site</a></li>
</ul>

i have also two file addNewSite.jsp and listWebSites.jsp residing in same directory of the portlet project

here is the stack trace.

Caused by: javax.servlet.ServletException: Le fichier &quot;/addNewWebSite.jsp&quot; n'a pas été trouvé
    at org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:412)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
    at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
    at com.liferay.portlet.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:331)
    at com.liferay.portlet.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:112)
    ... 167 more
14:18:29,497 ERROR [http-bio-8080-exec-25][render_portlet_jsp:132] null
Nwawel A Iroume
  • 1,249
  • 3
  • 21
  • 42

2 Answers2

1

Nwawel, I believe the problem happens in the <portlet:param> tag.

In MVCPortlet, if you want to call a JSP page directly from another JSP page, you have to name the the portlet:param's name as "mvcPath", say:

<portlet:renderURL var="varA">
    <portlet:param name="mvcPath" value="/a.jsp"/>
</portlet:renderURL>

<portlet:renderURL var="varB">
    <portlet:param name="mvcPath" value="/b.jsp"/>
</portlet:renderURL>

<a href="<%=varA %>">Link to A</a>
<a href="<%=varB %>">Link to B</a>

This will work fine.

Hope this will help you.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
0

In your renderURL you are calling the addNewWebSite.jsp but your file is named addNewSite.jsp The exception shows that addNewWebSite.jsp doesn't exist.

Adjust the name of wich one and then try again.

You have set the render-param, pointing to the "/addNewWebSite.jsp", but you said the name of your file is "addNewSite.jsp", so, the render is looking for "addNewWebSite.jsp", but can't find it, because in the folder there is "addNewSite.jsp".

TioDavid
  • 36
  • 7