Portal servlet ver. 1.6

This is a Java servlet lets you combine a set of sites on the same screen. Each site will be wrapped as a separate box (portlet). How to use it:

1) download portalPackage.jar and save it in WEB-INF/lib

2) describe PortalServlet in your web.xml file. Servlet reads own settings from the configuration file. You must set this configuration file as an initial parameter for servlet. Parameter name is config. E.g.:
 


    <servlet>
    <servlet-name>PortalServlet</servlet-name>
    <servlet-class>com.jsos.portal.PortalServlet</servlet-class>
    <init-param>
     <param-name>config</param-name>
     <param-value>path_to_your_configuration_file</param-value>
    </init-param>
    </servlet>

3) define a mapping:
 


    <servlet-mapping>
     <servlet-name>PortalServlet</servlet-name>
     <url-pattern>/servlet/portal</url-pattern>
    </servlet-mapping>

and now you can use it:
 


http://your_host/servlet/portal

Configuration file is a xml file. It has got the following form:
 


<?xml version="1.0" encoding="UTF-8"?>
<portal title="title_for your portal">

<portlet title="title_for_this_portlet" url="URL_for_this_portlet"/>
<portlet title="title_for_this_portlet" url="URL_for_this_portlet"/>
...
</portal>

for example:
 


<?xml version="1.0" encoding="UTF-8"?>
<portal title="Search engines">

<portlet title="Google" url="http://www.google.com"/>
<portlet title="Yahoo" url="http://www.yahoo.com"/>
<portlet title="Bing" url="http://www.bing.com"/>

</portal>

Customization:

You can replace default CSS settings for the portal and portlets. Beyond the title you can provide the following optional attributes for tag portal:

body - describes CSS settings for the body. Default value is:

background: #ccb; color: #555;
font: 11px Arial, sans-serif;

header - describes CSS settings for the header. Default value is:

background: #998;
border-color: #fff #665 #665 #fff;
border-style: solid;
border-width: 1px;
color: #fff;
font-weight: bold;
margin: 0 0 10px;
padding: 5px 10px;

footer - describes CSS settings for the footer. Default value is:

clear: both; color: #443;
border-top: 1px dashed #998;
font-weight: bold;
letter-spacing: 1px;
margin: 0 5px;
padding: 5px 0;
text-align: center;

For downloading:   portalPackage.jar   

Sample of config file: prtconf.xml
 

 © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in Coldtags: