You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Bo...@americawest.com on 2001/09/28 18:43:47 UTC

HelloWorldPortlet...

All,

I have become pretty frustrated trying to get this HelloWorld Portlet to
work.  Here are the steps I followed to do the HelloWorld example...can
anyone tell me what I am doing wrong (bare in mind I'm a newbie at this and
still working on understanding all this)??

1.  Created the portlet
/usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/classes/HelloWorldPortl
et.java file.  Code is here....
import org.apache.jetspeed.portal.portlets.AbstractPortlet;
import org.apache.turbine.util.RunData;
import org.apache.ecs.*;

public class HelloWorldPortlet extends AbstractPortlet
{
    publicConcreteElement getContent (RunData aRunData)
    {
	return (new StringElement ("Hello World!!"));
    }
}

2.  Compiled the code to the same directory to get a HelloWorldPortlet.class
file.

3.  Created a file called
/usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/conf/local-portlets.xre
g with the following entry...
<portlet-entry name="HelloWorldPortlet" hidden="false" type="instance"
application="false"> 
<meta-info> 
<title>Hello World Example</title> 
</meta-info> 
<classname>HelloWorldPortlet</classname> 
<media-type ref="html"/> 
</portlet-entry>

4.  Added the following to the
/usr/local/Jetspeed-1.3a1/bin/webapp/WEB-INF/conf/jetspeed-config.jcfg...
<portlet-entry type="instance" name="HelloWorldPortlet"> 
<classname>HelloWorldPortlet</classname> 
</portlet-entry>

5.  Added the following code to
/usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/psml/anon/html/en/defau
lt.psml...
<portlets>
<entry type="ref" parent="HelloWorldPortlet"/> 
</portlets>


Now...I am able to select the portlet from the list when I go to the 'Add
Portlets' section in Jetspeed.  However, when I click on 'Save and Apply'
the portlet does NOT display on my homepage.  I'm not sure if I am doing
something wrong or there is something that I have left out.  Can anyone see
what I am doing wrong or maybe something that I have forgotten to do??  Any
help would greatly be appreciated!  Thanks in advance!!

Regards,
Bob Wilson.




Re: HelloWorldPortlet...

Posted by Paul Spencer <pa...@mikon.com>.
Bob,
I noticed that Tomcat need to be restarted when the portlet class file
changes.

Below is your HelloWorldPortlet that displays the time on the server.  I
added the time so the content of the portlet would change.

Paul Spencer


import java.util.Date;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.portal.portlets.AbstractPortlet;
import org.apache.turbine.util.RunData;
import org.apache.ecs.*;

public class HelloWorldPortlet extends AbstractPortlet
{
    /**
    By default the data is non cacheable
    */
    public void init( ) throws PortletException
    {
        setCacheable( false );
    }

    public ConcreteElement getContent (RunData aRunData)
    {
        return (new StringElement ("Hello World!! Time on the servers is
" + new Date()));
    }
}

Paul Spencer

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: HelloWorldPortlet...

Posted by Paul Spencer <pa...@mikon.com>.
Bob,
I have created your HelloWorldPortlet just per your instructions. With
the exception a a missing space between "public" and "ConcreteElement"
and adding the portlet to a user's portal via the customize, instead of
editing the psml file in step #5, it works!

In step #5 you may be editing the wrong PSML file.

Remember jetspeed.log is you friend!  It will tell you which PSML file
is being used.

Paul Spencer

Bob.Wilson@americawest.com wrote:
> 
> All,
> 
> I have become pretty frustrated trying to get this HelloWorld Portlet to
> work.  Here are the steps I followed to do the HelloWorld example...can
> anyone tell me what I am doing wrong (bare in mind I'm a newbie at this and
> still working on understanding all this)??
> 
> 1.  Created the portlet
> /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/classes/HelloWorldPortl
> et.java file.  Code is here....
> import org.apache.jetspeed.portal.portlets.AbstractPortlet;
> import org.apache.turbine.util.RunData;
> import org.apache.ecs.*;
> 
> public class HelloWorldPortlet extends AbstractPortlet
> {
>     publicConcreteElement getContent (RunData aRunData)
>     {
>         return (new StringElement ("Hello World!!"));
>     }
> }
> 
> 2.  Compiled the code to the same directory to get a HelloWorldPortlet.class
> file.
> 
> 3.  Created a file called
> /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/conf/local-portlets.xre
> g with the following entry...
> <portlet-entry name="HelloWorldPortlet" hidden="false" type="instance"
> application="false">
> <meta-info>
> <title>Hello World Example</title>
> </meta-info>
> <classname>HelloWorldPortlet</classname>
> <media-type ref="html"/>
> </portlet-entry>
> 
> 4.  Added the following to the
> /usr/local/Jetspeed-1.3a1/bin/webapp/WEB-INF/conf/jetspeed-config.jcfg...
> <portlet-entry type="instance" name="HelloWorldPortlet">
> <classname>HelloWorldPortlet</classname>
> </portlet-entry>
> 
> 5.  Added the following code to
> /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/psml/anon/html/en/defau
> lt.psml...
> <portlets>
> <entry type="ref" parent="HelloWorldPortlet"/>
> </portlets>
> 
> Now...I am able to select the portlet from the list when I go to the 'Add
> Portlets' section in Jetspeed.  However, when I click on 'Save and Apply'
> the portlet does NOT display on my homepage.  I'm not sure if I am doing
> something wrong or there is something that I have left out.  Can anyone see
> what I am doing wrong or maybe something that I have forgotten to do??  Any
> help would greatly be appreciated!  Thanks in advance!!
> 
> Regards,
> Bob Wilson.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: HelloWorldPortlet...

Posted by Marty <mp...@intlsc.com>.
You shouldn't need to add it to your classpath, but you should add your 
package to the Turbine properties file right after the entries for Turbine 
and Jetspeed.

modules entry.


On Monday 01 October 2001 08:18, you wrote:
> Hi Bob,
>
> Add the LOCATION of the   HelloWorldPorlet.class, in your CLASSPATH
> setting. It will work. Please check the log files for erros.
>
> Regards
>
> Peter Rajesh
>
> Bob.Wilson@americawest.com wrote:
> > All,
> >
> > I have become pretty frustrated trying to get this HelloWorld Portlet to
> > work.  Here are the steps I followed to do the HelloWorld example...can
> > anyone tell me what I am doing wrong (bare in mind I'm a newbie at this
> > and still working on understanding all this)??
> >
> > 1.  Created the portlet
> > /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/classes/HelloWorldPo
> >rtl et.java file.  Code is here....
> > import org.apache.jetspeed.portal.portlets.AbstractPortlet;
> > import org.apache.turbine.util.RunData;
> > import org.apache.ecs.*;
> >
> > public class HelloWorldPortlet extends AbstractPortlet
> > {
> >     publicConcreteElement getContent (RunData aRunData)
> >     {
> >         return (new StringElement ("Hello World!!"));
> >     }
> > }
> >
> > 2.  Compiled the code to the same directory to get a
> > HelloWorldPortlet.class file.
> >
> > 3.  Created a file called
> > /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/conf/local-portlets.
> >xre g with the following entry...
> > <portlet-entry name="HelloWorldPortlet" hidden="false" type="instance"
> > application="false">
> > <meta-info>
> > <title>Hello World Example</title>
> > </meta-info>
> > <classname>HelloWorldPortlet</classname>
> > <media-type ref="html"/>
> > </portlet-entry>
> >
> > 4.  Added the following to the
> > /usr/local/Jetspeed-1.3a1/bin/webapp/WEB-INF/conf/jetspeed-config.jcfg...
> > <portlet-entry type="instance" name="HelloWorldPortlet">
> > <classname>HelloWorldPortlet</classname>
> > </portlet-entry>
> >
> > 5.  Added the following code to
> > /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/psml/anon/html/en/de
> >fau lt.psml...
> > <portlets>
> > <entry type="ref" parent="HelloWorldPortlet"/>
> > </portlets>
> >
> > Now...I am able to select the portlet from the list when I go to the 'Add
> > Portlets' section in Jetspeed.  However, when I click on 'Save and Apply'
> > the portlet does NOT display on my homepage.  I'm not sure if I am doing
> > something wrong or there is something that I have left out.  Can anyone
> > see what I am doing wrong or maybe something that I have forgotten to
> > do??  Any help would greatly be appreciated!  Thanks in advance!!
> >
> > Regards,
> > Bob Wilson.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: HelloWorldPortlet...

Posted by Peter Rajesh <ra...@siptech.co.in>.
Hi Bob,

Add the LOCATION of the   HelloWorldPorlet.class, in your CLASSPATH setting. It
will work. Please check the log files for erros.

Regards

Peter Rajesh

Bob.Wilson@americawest.com wrote:

> All,
>
> I have become pretty frustrated trying to get this HelloWorld Portlet to
> work.  Here are the steps I followed to do the HelloWorld example...can
> anyone tell me what I am doing wrong (bare in mind I'm a newbie at this and
> still working on understanding all this)??
>
> 1.  Created the portlet
> /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/classes/HelloWorldPortl
> et.java file.  Code is here....
> import org.apache.jetspeed.portal.portlets.AbstractPortlet;
> import org.apache.turbine.util.RunData;
> import org.apache.ecs.*;
>
> public class HelloWorldPortlet extends AbstractPortlet
> {
>     publicConcreteElement getContent (RunData aRunData)
>     {
>         return (new StringElement ("Hello World!!"));
>     }
> }
>
> 2.  Compiled the code to the same directory to get a HelloWorldPortlet.class
> file.
>
> 3.  Created a file called
> /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/conf/local-portlets.xre
> g with the following entry...
> <portlet-entry name="HelloWorldPortlet" hidden="false" type="instance"
> application="false">
> <meta-info>
> <title>Hello World Example</title>
> </meta-info>
> <classname>HelloWorldPortlet</classname>
> <media-type ref="html"/>
> </portlet-entry>
>
> 4.  Added the following to the
> /usr/local/Jetspeed-1.3a1/bin/webapp/WEB-INF/conf/jetspeed-config.jcfg...
> <portlet-entry type="instance" name="HelloWorldPortlet">
> <classname>HelloWorldPortlet</classname>
> </portlet-entry>
>
> 5.  Added the following code to
> /usr/local/etc/tomcat_3.2.3/webapps/jetspeed/WEB-INF/psml/anon/html/en/defau
> lt.psml...
> <portlets>
> <entry type="ref" parent="HelloWorldPortlet"/>
> </portlets>
>
> Now...I am able to select the portlet from the list when I go to the 'Add
> Portlets' section in Jetspeed.  However, when I click on 'Save and Apply'
> the portlet does NOT display on my homepage.  I'm not sure if I am doing
> something wrong or there is something that I have left out.  Can anyone see
> what I am doing wrong or maybe something that I have forgotten to do??  Any
> help would greatly be appreciated!  Thanks in advance!!
>
> Regards,
> Bob Wilson.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org