You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This page is meant to be a list of issues that users ave encountered while migrations existing SAF1 application to SAF2, or developing new Webwork-based applications. If you have a solution to the issue that will of course be most helpful, but even if you don't it is worth noting what you encountered none the less in the hopes that someone else can come along and answer it for you, and the rest of us.

How do we set checkboxes false (on uncheck)?

  • Use a boolean to represent the checkbox property
  • Implement the preparable interface
    • Implement a prepare method and set all checkbox booleans to false
  • Or, set the checkbox booleans to the false value using static parameters.

If the Action is model-backed and persisted in the session

  • Use an Action property as a buffer for the checkbox boolean.
  • On Save, set the model property to the Action property.
    • These extra steps avoid setting the model properties to false prematurely.

See also

How to set the focus on a form field?

SAF1 generates a little JavaScript that helps set the focus, if you specify the field in the JSP.

Another solution is to use a generic Javascript that automatically seeks the first enabled form field on page.

(Building this script into SAF2 is being considered.)

What is the analogy to ForwardAction?

The default Action class (ActionSupport) returns SUCCESS by default, and SUCCESS is the default result. Using an action to forward directly to a page is easy:

<action name="Welcome">
<result>/pages/Welcome.jsp</result>
</action>

How do you emulate the default="true" attribute of a SAF1 Action mapping?

Rather than tag the action as being the default, the default action is set by name using default-action-ref element.

<default-action-ref name="defaultAction">

By using an element, rather than an attribute, packages can inherit the default action name.

Next: ActionContext


This material originally adopted from: http://wiki.apache.org/struts/IssuesAndSolutions.

  • No labels