9 Replies Latest reply on Feb 23, 2005 11:06 AM by julien1

    Preferences

    patrickdalla

      My portlet-instances.xml is as follow:

      <?xml version="1.0" standalone="yes"?>
      <instances>
       <instance>
       <instance-name>Servicos</instance-name>
       <component-name>PagePortlet</component-name>
       <preferences>
       <preference>
       <name>teste</name>
       <value>teste</value>
       </preference>
       </preferences>
       <security>
       <rules>
       <rule role="Admins" patterns=".*:.*" level="admin"/>
       <rule role="Users" patterns=".*:.*" level="add"/>
       <rule role="" patterns=".*:.*" level="read"/>
       </rules>
       </security>
       </instance>
      </instances>
      


      I've tryed to access the preference of the instance with:

      request.getPreferences().getValue("teste","abc");

      in the render method of the portlet but the returned value was "abc", the default value passed as the second param.

        • 1. Re: Preferences
          patrickdalla

          is it right?

          how is the right way to access a portlet instance preference

          • 2. Re: Preferences

            did you declare the pref in the portlet.xml as well ?

            • 3. Re: Preferences
              patrickdalla

              No.

              I have to declare the preference? How?

              There is a help for these xml files?

              • 4. Re: Preferences
                patrickdalla

                I've changed the portlet.xml to:

                <?xml version="1.0" encoding="UTF-8"?>
                <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd" version="1.0">
                 <portlet>
                 <portlet-name>PagePortlet</portlet-name>
                 <portlet-class>br.gov.trf2.jfes.intranet.portlets.PagePortlet</portlet-class>
                 <supported-locale>en</supported-locale>
                 <resource-bundle>Resource</resource-bundle>
                 <supports>
                 <mime-type>text/html</mime-type>
                 <portlet-mode>VIEW</portlet-mode>
                 <portlet-mode>HELP</portlet-mode>
                 </supports>
                 <portlet-info>
                 <title>Page include portlet</title>
                 </portlet-info>
                 <portlet-preferences>
                 <preference>
                 <name>teste</name>
                 <value>portlet</value>
                 </preference>
                 </portlet-preferences>
                 </portlet>
                </portlet-app>
                


                And the value returned was "portlet" and not anymore the default value.

                But I want it to return the instance value "teste" just as configured in portlet-instances.xml i've posted in the first message.

                • 5. Re: Preferences

                  I am going to look into it

                  • 6. Re: Preferences
                    patrickdalla

                    Ok.

                    When you've solved the problem post a message here.

                    thanks

                    • 7. Re: Preferences

                      it is fixed now

                      • 8. Re: Preferences
                        patrickdalla

                        So?

                        what class do I have to update?

                        how I get the source code?

                        I'm behind a firewall and connot use cvs. Can I download via http?

                        • 9. Re: Preferences

                          not yet available on http, only available through CVS access.

                          I have requested a daily archive for the portal, but I think it is not done yet : http://jira.jboss.com/jira/browse/JBQA-68

                          you can vote for it :-)