Versions Compared

Key

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

...

How to set the focus on a form field?

What is the analogy to ForwardAction?

...

One of the Struts "best practices" is that all requests within an application should go through Struts. So, you should generally never reference a JSP directly for instance. To help with this, Struts provides the !ForwardAction, which is more or less an Action that does nothing, it just immediately returns and forwards to the URI as configured. Webwork does not appear to have a direct analogy to this. However, it is easy to get the same effect in a couple of possible ways.

...

Here is a reference to the thread discussing this: http://forums.opensymphony.com/thread.jspa?threadID=23755&tstart=15

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

In SAF1, it is possible to set the default attribute of an Action mapping in struts-config.xml to true.  Then, any request coming in to ActionServlet that does not match a configured Action mapping will result in that mapping being executed.

SAF2 does not (at this point in time at least) provide this attribute.  However, there is a way to get the same effect.

Within xwork.xml (struts.xml?), on a per-package basis, you can have the following: 

Code Block

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

 This says that for the package this is declared in, the mapping with the name defaultAction will be executed when any request comes in that does not match any other mapping.

Next: ActionContext

...

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