10 Replies Latest reply on Jul 18, 2007 10:55 AM by krishna Gopu

    Handling Portal/Portlet Preferences

    krishna Gopu Newbie

      Can some one please post info on how and where the portlet preferences are to diclared/used.

      Precisely which discriptor files.

      i am using 2.6 Portal

        • 1. Re: Handling Portal/Portlet Preferences
          Peter Johnson Master

          You can declare preferences in portlet.xml and portlet-instances.xml. The preferences declare in portlet.xml are the defaults, while the ones in portlet-instances.xml override those preferences for a given instance.

          • 2. Re: Handling Portal/Portlet Preferences
            krishna Gopu Newbie

            Thanks fore the reply.

            The thing is need a bit of clarification.
            Though i am using 2.6 Portal, Which has a DTD saying to declare preferences in portlet-instances.xml, but the output is not as expected. I was forced to put the preferences in portlet.xml which is true according to older versions of Portal.
            I havent installed any DBserver and started to run the HelloWorld examples from portletswap, migrating them to 2.6 portal. It would be really helpful and appreciated if you can throw light on the setup with out having DB in the environment.

            • 3. Re: Handling Portal/Portlet Preferences
              Antoine Herzog Master

              For just "looking at it", you can use the hypersonic database.
              it is provided with jboss portal, and is the default database.

              look at the documentation about it. (installing and starting).

              for the preference : all is quiet well explained in the doc.

              sometimes it is a question of a detail (double check the names, etc...).

              Also, if your are not sure of what's going on : you can stop the server, delete the database (delete the files of hypersonic) and restart the server... all the config restart from the descriptor files.

              • 4. Re: Handling Portal/Portlet Preferences
                Peter Johnson Master

                If you code it correctly, it will work - I know because it works for me. Antoine's suggestion of double-checking your spelling is right-on, that is usually the problem when it doesn't work for me.

                If that doesn't solve the problem, post your portlet.xml, porltet-instances.xml, and code that accesses the preferences. If those files are large, post only the preferences for one of the portlets that exhibits the problem.

                Out of curiosity, why did you post a generic "who do you do X?" question instead of indicating up front that you had a problem?

                • 5. Re: Handling Portal/Portlet Preferences
                  Thomas Heute Master

                  explorer, the thing is that you need to put your preferences in portlet.xml but you can override the values *per* instance (in portlet-instance.xml)

                  • 6. Re: Handling Portal/Portlet Preferences
                    krishna Gopu Newbie

                    Hai Guys,

                    Those are really good pieces of advice for a beginner like me.


                    For just "looking at it", you can use the hypersonic database.
                    it is provided with jboss portal, and is the default database.


                    Well, Antonie talked about a hypersonic DB built into JBoss, Where is that located and how should i delete the files. There is a portal-hsqldb-ds.xml and how should i configure it.

                    Once again thank you very much for the help.

                    For PeterJ: well first i was trying to figure out where i had to put the preferences,looking at the DTDs for 2.6 i tried putting them in -instances.xml but did not work out and then i put the preferences in portlet.xml, then the preferences were picked up. Then later i figured out that the problem might be related to the error being thrown. So i started the post this way.



                    • 7. Re: Handling Portal/Portlet Preferences
                      Peter Johnson Master

                      The Hypersonic data file is located at server/xxx/data/hypersonic/localDB.script. Look for it only after you stop the app server. The file contains the SQL statements necessary to rebuild the database when the app server is restarted. There is not change needed to the hsqldb-ds.xml file. If you plan to go into production with your portal, you should switch to a real database, such as PostgreSQL or MySQL (actually, you should seriously consider that even for development). Instructions are in the reference guide.

                      • 8. Re: Handling Portal/Portlet Preferences
                        Andrew Brownfield Newbie

                         

                        actually, you should seriously consider that even for development


                        I concur. I actually found it much easier to understand the environment when using a full database. There are more tools out there to dig through MySQL than there are for hypersonic. I'm not sure what the performance differences are, but for learning about what's going on behind the scenes, a real database was certainly easier.

                        • 9. Re: Handling Portal/Portlet Preferences
                          krishna Gopu Newbie

                          Thanks for the reply guys.
                          I had started using a real DB (Oracle) Thats in the project environment.

                          Well, i was trying to work around applying a theme and style to my portal.

                          But from the -Object.xml i was getting this error.

                          org.jboss.deployment.DeploymentException: namespace BGPortal Context already exists; - nested throwable: (org.jboss.portal.core.model.portal.Dupli
                          catePortalObjectException: namespace already exists)
                           at org.jboss.portal.core.deployment.jboss.ObjectDeployment.start(ObjectDeployment.java:101)
                           at org.jboss.portal.server.deployment.jboss.DeploymentContext.start(DeploymentContext.java:99)
                           at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfoContext.start(PortalDeploymentInfoContext.java:211)
                          

                          The BGPortal-object.xml is as below. Here in this, what ever i make changes to the context name... same error is thrown with the changed name.
                          <?xml version="1.0" encoding="UTF-8"?>
                          <!DOCTYPE deployments PUBLIC
                           "-//JBoss Portal//DTD Portal Object 2.6//EN"
                           "http://www.jboss.org/portal/dtd/portal_object_2_6.dtd">
                          
                          <deployments>
                           <deployment>
                           <parent-ref/>
                           <if-exists>overwrite</if-exists>
                           <context>
                           <context-name>BGPortal Context</context-name>
                           <properties>
                           <property>
                           <name>layout.id</name>
                           <value>2ColumnLayout</value>
                           </property>
                           <property>
                           <name>theme.id</name>
                           <value>simple-sample</value>
                           </property>
                           </properties>
                           </context>
                           </deployment>
                           <deployment>
                           <parent-ref/>
                           <if-exists>overwrite</if-exists>
                           <portal>
                           <portal-name>BGPortal</portal-name>
                           <page>
                           <page-name>default</page-name>
                           <window>
                           <window-name>ARPWindow</window-name>
                           <instance-ref>ARPInstance</instance-ref>
                           <region>left</region>
                           <height>0</height>
                           </window>
                           </page>
                           </portal>
                           </deployment>
                          </deployments>
                          

                          The corresponding, theme and layout are properly defined.

                          The layout.jsp i am using is as below.
                          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                          
                          <%@ taglib uri="/WEB-INF/theme-basic-lib.tld" prefix="basic" %>
                          
                          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
                           <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
                          <body>
                          <!-- center table with columns -->
                          <basic:forEachWindowInRegion region='left'>
                           <table width="100%" bgcolor="#FFFFFF">
                           <tr>
                           <td class="leftColumn">
                           This should appear to the left. - from basic tag
                           </td>
                           </tr>
                           </table>
                          </basic:forEachWindowInRegion>
                          </body>
                          </html>
                          
                          


                          • 10. Re: Handling Portal/Portlet Preferences
                            krishna Gopu Newbie

                            Anyways,
                            I got it to work.
                            Thanks.