Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here is a quick reference for how input and output types map from xaction xml files to an Action bean:.

Inputs

During an action sequence, the Action framework will attempt to pass all the information you intend for your Action bean.  The action-inputs section of your action definition is the contract which tells the Action framework all the things that your Action bean requires to execute successfully.  In the following table, we've listed the various XML that the Action framework might encounter along with the method that the Action framework will expect to find on your Action bean.  If an appropriate setter method is not found on your Action bean, the framework will report a warning and proceed to the next input.  If an appropriate setter method is found, but the value of the input cannot be converted to the type declared in your setter method, the framework will report an error and fail execution.

xaction input

Java type

expected Action bean method (Java)
(all methods start with 'public void')

<myInput type="string">

java.lang.String

setMyInput(String s) { ...

<myInput type="long">

java.lang.Long

setMyInput(Long n) { ...

<myInputMap type="property-map">

java.util.Map<java.lang.String, java.lang.String>

setMyInputMap(Map<String, String> m) { ...

<myInputListMap type="property-map-list">

java.util.List<java.util.Map<java.lang.String, java.lang.String>>

setMyInputListMap(List<Map<String, String>> lml) { ...

<myInputList type="string-list">

java.util.List<java.lang.String>

setMyInputList(List<String> l) { ...

<myInput> (no type specified)

In this case, the Action framework does not know the type and will try to convert the data to the type specified in your Action's setter method.  If the conversion fails, you will see a warning to this effect.

setMyInput(Object o),
or
 setMyInput(SomeOtherType t) //of course this will only work if the data can be cast to a SomeOtherType type

 

 

 

Outputs

xaction output

Java type

expected Action bean method (Java)

<myOutput type="content"/>

java.io.OutputStream

public void setMyOutputStream(OutputStream o)(star)
{ ...

 

 


(star) Note the content type output is treated like an input since the presence of a content type implies that your Action bean intends to write to a pre-existing data stream. This pre-existing stream is retrieved by the Action framework code and passed to your Action bean as a java.io.OuputStream prior to your Action bean executing.

Resources

xaction resource

Java type

expected Action bean method (Java)

<myResource type="resource"/>

java.io.InputStream

setMyResource(InputStream o) { ...

 

 


Resources

Outputs

Action Error Handling

FAQ

How are Actions different than POJO Components? I thought POJO Components already supported the ability to drop in a Java bean and have it work as a "component".