Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{snippet:id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor}
Tip

To create a Model Driven action, implement the ModelDriven interface by adding a model property, or at least the accessor.

public Object getModel() ...

In the implementation of getModel, acquire an instance of a business object and return it.

On the page, you can address any JavaBean properties on the business object as if they were coded directly on the Action class. (The framework pushes the Model object onto the ValueStack.)

Many developers use Spring to acquire the business object. With the addition of a setModel method, the business logic can be injected automatically.

Parameters

Wiki Markup
{snippet:id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor}

Extending the Interceptor

Wiki Markup
{snippet:id=extending|javadoc=true|url=com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor}

Examples

Wiki Markup
{snippet:id=example|lang=xml|javadoc=true|url=com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor}

Model Driven Interceptor

The Model Driven interceptor allows ...

Parameters

Name

Type

Required

Description

 

 

 

 

Extending the Interceptor

Describe possible extensions to the existing interceptor.

Examples

Given an Action, SomeAction, add a reference to the Model Driven interceptor.

Code Block
xmlxml

<action name="SomeAction" class="com.examples.SomeAction">
   <interceptor-ref name="model-driven"/>
   <result name="success" type="freemarker">good_result.ftl</result>
</action>