Creating the Action

Print

 

If you followed the quickstartguide you now have a configured environment ready to test your first Action.

Make a new Action, implementing net.sourceforge.javajax.JavajaxAction interface and place it in one of the action packages specified in web.xml. 

Since your class will look like my.very.nested.package.MyOldFashionActionClass, and since the URL to call this class depends on the class name, maybe we want to bind the class to a smarter name. 

Here the UrlBinding annotation come in hands. 

Place it before the class declaration:

 

package my.very.nested.package; 

@UrlBinding("MyAction")
public class MyOldFashionActionClass implements JavajaxAction { ... }


All the "callable" methods in the action MUST be "protected", so our first method would look like: 

protected void myMethod(){
System.out.println("Hello World!");
}


When a method is called and an exception is raised, or a validation error message is generated, the framework will display the error page defined in web.xml, or we can inform what else to do: 

onError("myPage.jsp")
protected void myMethod(){
System.out.println("Hello World!");
}