...
- Security Checking (ensuring the user is logged in)
- Trace Logging (logging every action)
- Bottleneck Checking (start a timer before and after every action, to check bottlenecks in your application)
You can also chain Interceptors together to create "packages"an interceptor stack. If you wanted to do a login check, security check, and logging all before an Action call, this could easily be done with an interceptor package.
Example
Code Block | ||||
---|---|---|---|---|
| ||||
<interceptors>
<interceptor-stack name="defaultComponentStack">
<interceptor-ref name="component"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
|
To use them in your actions:
Code Block | ||||
---|---|---|---|---|
| ||||
<action name="VelocityCounter" class="com.opensymphony.webwork.example.counter.SimpleCounter"> <result name="success">. |
...
..</result>
<interceptor-ref name="defaultComponentStack"/>
</action>
|
For more details, see Interceptors reference.For further Reading on Interceptors, see Xwork Interceptors
For further Reading on Xwork configuration files, see Xwork Configuration
Views
WebWork supports JSP and Velocity for your application presentation layer. For this example we will use a JSP file. Webwork comes packaged with a tag library (taglibs). You can use these taglibs as components in your JSP file. Here is an section of our form.jsp page:
...