2 Replies Latest reply on Oct 4, 2005 4:25 PM by Alex Saar

    Portlet initialization problem

    Alex Saar Newbie

      maybe this is a silly question, but I'm a newbie on portlets and JBoss portal. I have a simple portlet for database queries. In this portlet I will init the URLs of the related JSPs via init params in the portlet.xml.

      This is my portlet.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
       version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
       <description>A portlet for DB queries.</description>
       <display-name>Query Portlet</display-name>
       <title>A Query Portlet for execution of DB queries.</title>
       <short-title>Query Portlet</short-title>
       <value>Query Portlet</value>

      This is my portlet class:
      public class QueryPortlet extends GenericPortlet {
       private String viewUrl;
       private String editUrl;
       private String helpUrl;
       public void init(PortletConfig config) throws PortletException {
       // after these lines viewUrl ... are NULL
       viewUrl = config.getInitParameter("view_url");
       editUrl = config.getInitParameter("edit_url");
       helpUrl = config.getInitParameter("help_url");

      The portlet itself works fine, but after execution of init() the URL members are NULL. I debugged this problem with the JBossIDE and found out that the init param values and keys are available in the PortletConfig. But the problem remains!

      Because init params are not considered in the HelloWorld example, I looked at the forums portlet. In the forums portlet they use JBossPortlet instead of GenericPortlet as base class for the portlet implementation.

      So finally my question is: Is it necessary to use JBossPortlet instead of GenericPortlet to get the init param values or is there another trick to get this work?

      Best regards,