4 Replies Latest reply on Nov 16, 2006 1:21 PM by Thomas Heute

    Restricting link & form actions within the same portlet

    Girish Ramagiri Newbie


      I have integrated an already existing application within a portlet.
      However I have observed issue with respect to link and form actions.

      Suppose if I click on a button in a jsp, the destination jsp spreads to the whole screen overlapping all the porlets.
      The code for onclick javascript is:
      function doLink(src)
      window.location = src;

      What changes need to be done inorder to view the destination jsp within the same portlet after clicking on a button (form submit) or on a link?

      Many Thanks in Advance,

        • 1. Re: Restricting link & form actions within the same portlet
          Burkhard Vogt Newbie

          Have you considered an integration of your application by an iframe tag?

          Unfortunately this may cause some (ugly) scrollbar issues...


          • 2. Re: Restricting link & form actions within the same portlet
            Thomas Heute Master

            You need to use portlet URLS, see the portlet spec.

            • 3. Re: Restricting link & form actions within the same portlet
              Girish Ramagiri Newbie

              Hi Thomas,

              Thanks for your input.

              Inorder to use PortletURL, I need to extend PortalJSP & use portlet taglib in the jsp which has the buttons.

              After extending the PortalJSP & incorporating portlet taglib, the existing jsp along with the existing tags looks as below:

              <%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
              <%@ page language="java" pageEncoding="UTF-8"%>
              <%@ page import="com.myapp.web.user.bean.User" %>
              <%@ page import="com.myapp.web.utility.apputils.component.AppConstants" %>
              <%@ page import="com.myapp.web.utility.apputils.component.ActionConstants"%>
              <%@ page import="com.myapp.web.resources.ApplicationProperties;"%>
              <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
              <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
              <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
              <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
              <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
              <%@ taglib uri="/WEB-INF/struts/tld/struts-nested.tld" prefix="nested" %>

              As soon as the jsp loads, NullPointerException is thrown as follows:

              2006-11-16 22:06:20,677 DEBUG [org.apache.catalina.loader.WebappClassLoader] Loading class from local repository
              2006-11-16 22:06:20,677 INFO [STDOUT] ERROR [jsp].error:119 - Servlet.service() for servlet jsp threw exception
               at org.jboss.portal.core.servlet.jsp.PortalJsp.service(PortalJsp.java:140)
               at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
               at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
               at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
               at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
               at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
               at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
               at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
               at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
               at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
               at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
               at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

              Is this because the portlet tags will not work if the jsp contains other functionality tags?

              However I noticed that when I remove PortalJSP & portlet taglib code, the jsp compiles without any error & also loads the contents.

              Many Thanks in Advance,

              • 4. Re: Restricting link & form actions within the same portlet
                Thomas Heute Master

                I don't know where you read that you had to extend PortalJSP, but please read the JSR-168 spec, il will help you a lot in portlet development.

                You don't need to extend PortalJSP