WORK IN PROGRESS : Help us with your contributions!!

Overview

The concept of Action faced from SmartWeb is the one of Struts: the operation to perform when the user makes an action like selecting a link, submitting a form or simply requesting an URL, any kind of URL.

Dyna Action

The innovation in SmartWeb is given from the introduction of a new class net.smartlab.web.DynaAction. This class resolves all a series of problems linked to the DispatchAction and the LookupAction, annexing them within itself. A DynaAction is in fact a DispatchLookupAction and comes realized in order to reduce and to produce a more intuitive management of the Struts "dynamic actions". In order to realize an Action it is suggested therefore to extend the DynaAction class and to opportunely shape it in the struts xml configuration file.

Abstract Archive Action

In addition to DynaAction the framework offers additional methods for the archives management through the net.smartlab.web.AbstractArchiveAction class which provides predefined interactions: list, find, save and remove among these. The advantage taken through this class is much of the work necessary to achieve the archive management interface is already coded:

Writing action mapping

Here we introduce a chip of code of the xml configuration file of Struts, that map a DynaAction.

To make an easier example we suppose to be true that the class that extends DynaAction is the following:

        public class MyAction extends DynaAction{
                
        public String list(ActionForm form, HttpServletRequest request,
                HttpServletResponse response, ActionMapping mapping) throws ActionException{
                        .
                        .
                        .
                        return "success";
                }
        }        

The configuration file will come out:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
        <form-beans>
                .
                .
                .
  </form-beans>
        <action-mappings>
                .
                .
        <action path="/my-first-dyna"
                        type="myPackage.MyAction"
                        name="myForm"
                        parameter="list"
                        scope="request"
                        <forward name="success" path="/myPath/success.jsp"/>
                        <forward name="failure" path="/myPath/failure.jsp"/>
        </action>
                .
    .
        </action-mappings>
        <message-resources parameter="resources.application"/>
</struts-config>

The attention must be placed on the list value of the parameter attribute that indicates the name of the method that will be effectively invoked.

  1. Getting started with AbstractArchiveAction