You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vincent Massol <vm...@octo.fr> on 2001/01/30 08:39:51 UTC

[Proposal] Portal Framework

Hi,

Here is an idea for extending Struts in future versions. However, I think we must not mix it with Struts code. It should be seen as an extension (what I like in Struts is it's simplicity and cluttering it with tons of features in the core will make it harder to use/install).

This is a proposal for bringing the following additional services to Struts. Note that this is more than a proposal, it comes from a real project that I have built and that I am using in production :
- Possibility to choose a JSP page based on several criteria : Language, Device type, User group, ... : thus support for building multi-language, mutli-device applications
- Template mechanism
- API (through custom JSP tags) to build Navigation menus
- Integration with Portlets from WebLogic Personalization Server 3.1/3.2
- Custom JSP tags

Principle :
- extension of ActionServlet and ActionForward to support includes in addition to forwards
- 3 Struts actions :
  - GetPageAction : responsible for retrieving a JSP page based on several criteria (it's id, Language, Device, user group, ...). The mapping between the physical JSP page and it's attributes is defined in an xml file (let's call it pages.xml).
  - GetTemplateAction : responsible for building a template page. A template is a JSP page with <pf:insertArea id="area1"/> tags whenever there is a need to insert a an area (equivalent to the BEA Portlet). A View is an instanciation of a template. A view is defined in an xml file (let's call it templates.xml). A view has an id. For each view, the following information is specified : the page id of the template JSP to use for that view, the list of page id to use for each of the area defined in the template.
  - GetPortletAction : integrates with WLPS by getting the Portlet(Area in our terminology) definition from the WL Database using the Portlet Manager API.
- An XML file (navigation.xml and navigation.properties) to define a hierarchy of links (supports multi-language and multi-device). These data are then accessed by using a provided custom JSP tag library (for doing operations such as getParent, getRoot, getSiblings, getAncestors, getChildren, .... and a getProperty for getting information on a link : label, url, level, ...)

How it works :
- the user calls http://.../mywebapp/getTemplate.do?view=viewid
- the GetTemplateAction action is called. It fins the entry corresponding to id viewid in it's XML configuration file (see below for a sample) and does a forward to the template file (/getPage.do?forward=templateid)
- the template files executes and each of the <pf:insertArea id="area1"/> tags do a jsp:include on their content, thus calling the GetPageAction (/getPage.do?include=pageid or /getPortlet.do?include=portlet name)
- the GetPortletAction calls a provided portlet.jsp file which is responsible for rendering a portlet. this portlet.jsp makes calls to the WL API to extract portlet definition values : content URL, ... The content URL is specified in the WL admin as : /getPage.do?include=pageid.

The XML file formats :

templates.xml

<?xml version="1.0"?>

<Views>
  <View id="technology/index" template="/getPage.do?forward=layout1">
    <Areas>
      <Area id="area1" content="/getPage.do?include=technology/areas/someText" />
      <Area id="area2" content="/getPortlet.do?include=Technology_News" />
      <Area id="area3" content="/getPage.do?include=technology/areas/userMgt" />
    </Areas>
  </View>

pages.xml

<?xml version="1.0"?>

<pages>

  <page id="layout1">
    <device type="WEB" default_uri="/web/templates/layout1.jsp"/>
    <device type="WAP" default_uri="/wap/templates/layout1.jsp"/>
  </page>

  <page id="technology/areas/someText">
    <device type="WEB" default_uri="/web/en/technology/someText.jsp">
      <language type="en" uri="/web/en/technology/someText.jsp"/>
      <language type="fr" uri="/web/fr/technology/someText.jsp"/>
    </device>
    <device type="WAP" default_uri="/wap/en/technology/someText.jsp">
      <language type="en" uri="/wap/en/technology/someText.jsp"/>
      <language type="fr" uri="/wap/fr/technology/someText.jsp"/>
    </device>
  </page>

  <!-- The "technews" area in the layout1 template. The definition for this  -->
  <!-- page id is found in the "Technology_News" Portlet definition in the   -->
  <!-- WLCS admin.                                                           -->
  <page id="technology/areas/technews">
    <device type="WEB" default_uri="/web/en/technology/technews.jsp">
      <language type="en" uri="/web/en/technology/technews.jsp"/>
      <language type="fr" uri="/web/fr/technology/technews.jsp"/>
    </device>
    <device type="WAP" default_uri="/wap/en/technology/technews.jsp">
      <language type="en" uri="/wap/en/technology/technews.jsp"/>
      <language type="fr" uri="/wap/fr/technology/technews.jsp"/>
    </device>
  </page>

[...]

The question : What do you think of this design ? Would you like to see this as an extension to Struts ? If you want more details, email me at vmassol@users.sourceforge.net

thanks.
Vincent.