1 Reply Latest reply on Feb 7, 2008 11:08 AM by peterj

    Jboss Portal With Spring Portlet

    ozguy123

      Hi
      I have some problems with the portlets and would like some help.
      I have a portlet which is using Spring portlet framework.
      Its a very simple portlet at the moment as i wanted to learn how it works with jboss.

      Portlet is deployed Successfully, but i dont see it in the Jboss Portal page with the other portals. Not sure whats wrong. No error messages in the log either.

      Here is the example :

      public class TodayPortlet extends GenericPortlet{

      public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      out.println("<h1>Welcome to the Pet Portal!</h1>");
      out.println("This portlet delegates to an existing JSR-168 portlet via a HandlerAdapter");
      out.println("(see WEB-INF/context/welcome-context.xml for the details).");
      out.println("Portlet Name: " + this.getPortletName() + "");
      out.println("Init Parameters:");
      out.println("Init Parameters:");

      for (Enumeration e = this.getInitParameterNames(); e.hasMoreElements();) {
      String name = (String)e.nextElement();
      out.println("" + name + " = " + this.getInitParameter(name) + "");
      }

      =======================
      web.xml:
      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/context/common.xml</param-value>
      </context-param>


      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>



      <servlet-name>view-servlet</servlet-name>
      <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
      <load-on-startup>1</load-on-startup>


      <servlet-mapping>
      <servlet-name>view-servlet</servlet-name>
      <url-pattern>/WEB-INF/servlet/view</url-pattern>
      </servlet-mapping>



      ==========================

      portlet.xml

      <portlet-name>welcomeToday</portlet-name>
      <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
      <init-param>
      contextConfigLocation
      /WEB-INF/context/welcome-portlet.xml
      </init-param>

      <mime-type>text/html</mime-type>
      <portlet-mode>view</portlet-mode>

      <portlet-info>
      Welcome
      </portlet-info>

      ============================

      portlet-instances.xml:




      <instance-id>WelcomePortletInstance</instance-id>
      <portlet-ref>welcomeToday</portlet-ref>




      ====================================
      welcome-object.xml:



      <if-exists>overwrite</if-exists>
      <parent-ref>default.default</parent-ref>

      <window-name>WelcomePortletWindow</window-name>
      <instance-ref>WelcomePortletInstance</instance-ref>
      left
      1




      ====================

      This is actually an example Portlet that came with SPring 2 distribution. Am just tryinig to get the Welcome Portlet running in Jboss which i can't do at the moment.

      Any help will be appreciated.


      [/url]

        • 1. Re: Jboss Portal With Spring Portlet
          peterj

          Login as admin, got to the admin portal, and see if you can find your portlet or portlet instance in the Management Portlet.

          By the way, when posting xml content, always bracket it with the "code" tags (use the Code button just above the input box), a preview your post before submitting.