pcsfw - Development

This page shows how to use the pcsfw in a simple way. We will create the worlds famous "Hello World" with pcsfw.

Prerequisites

pcstoolkit should be installed and work properly. Furthermore you should have some knowledge in Java, web applications, XML and XSLT.

Implement Action

At first we create an implementation of the Action-Interface. Action is defined via the interface de.spieleck.pcs.action.Action. It defines a method called perform which gets a hashtable containing parameters and returns a de.spieleck.pcs.action.ActionResult. An ActionResult contains XML and parameters. The parameters have to contain a parameter called "style", which holds the key used by View to lookup the correct stylesheet for XSL transformation.
Your result could like my HelloWorldAction.
Save this at the correct position in your server's classpath. Eventually you have to compile the file before using.

Create Stylesheet

Then we have to create a stylesheet which will used to transform the created XML by our HelloWorldAction to HTML to display it to the user. A possible stylesheet could be the helloworld.xsl. Save this file as helloworld.xsl in your xslt directory ( ordinary pcstoolkit/WEB-INF/xslt).

Tell pcsfw

As a last step, it's time to tell pcsfw about our new action and the stylesheet and combine them to a service. Therefore add an entry into your pcstoolkit configuration file, usually pcstoolkit/WEB-INF/pcs.xml.
This entry should look like
<service name="helloworld">
  <action name="HelloWorldAction" />
  <view file="helloworld.xsl" />
</service>
Notice that you have to use the full qualifying class name for your action, therefore it is possible that you should use something like com.myserver.mypcs.actions.HelloWorldAction.

Test it

Now our action should work and with an URL like http://yourserver.com/pcstoolkit/pcs/helloworld you should see something like on Spieleck.

$Id: developer.html,v 1.4 2003/01/20 20:49:29 pcs_org Exp $