Basic Workings of a Web Feature

 A typical IFS Web Client page will be a java class extending the ASPPageProvider class. To make this java page a web feature you need to implement the FndWebFeature interface. Apart from the interface implementation and the new package imports, all other basic workings of a web page is unchanged.

The skeleton program for a web feature class would look like this:

package ifs.demow.features.managemytodo;

import ifs.fnd.asp.*;
import ifs.fnd.service.Util;
import ifs.fnd.service.FndException;
import ifs.fnd.webfeature.FndWebFeature;

public class MyToDoTask extends ASPPageProvider implements FndWebFeature
{
   
   //===============================================================
   // Static constants
   //===============================================================
   public static boolean DEBUG = Util.isDebugEnabled("ifs.demow.features.managemytodo.MyToDoTask");
   
   //===============================================================
   // Instances created on page creation (immutable attributes)
   //===============================================================
   private ASPBlock blk;
   private ASPCommandBar cmdbar;
   private ASPTable tbl;
   private ASPBlockLayout lay;
   
   //===============================================================
   // Transient temporary variables (never cloned)
   //===============================================================
   private ASPContext ctx;
   
   //===============================================================
   // Construction
   //===============================================================
   public MyToDoTask(ASPManager mgr, String page_path) {
      super(mgr,page_path);
   }
   
   public void run() {
   }
   
   //===============================================================
   //  HTML
   //===============================================================
   protected String getDescription(){
      return "DEMOWEBFEATURETASKS: My ToDo Tasks";
   }

   protected String getTitle(){
      return getDescription();
   }

   protected void printContents() throws FndException {
      ASPManager mgr = getASPManager();
      appendToHTML(lay.show());
   }  
}

Download Java source code

The remainder of this chapter will discuss this skeleton class. Study it carefully because it will walk you through fundamental and important issues that concern all web feature classes. Before reading any further you should make sure that have read Cookbooks under "How to do things".

A web feature class should belong to a Java package, usually under ifs.xxx. In our case it is ifs.demow. It is always a good practice to keep pages and web features separate. Thus a different package for different features under the same component package is recommended. In the above template the feature package "managemytodo" is kept under a package called "ifs.demow.features".

package ifs.demow.features.managemytodo;

To emphasis on this package structure, you can have many feature packages under "ifs.demow.features". For an example "ifs.demow.features.webfeature1", "ifs.demow.features.webfeature2", "ifs.demow.features.webfeatureN". This keeps the basic web pages and web features separate from each other.

Apart from the above mentioned recommendations and simple code changes, the basic workings of a web feature is the same as the basic workings of a web page.