15. Advanced topics Flashcards
How would you configure an action to invoke a different method than execute()?
When defining your action, add the method=”test” attribute.
How would you configure dynamic mapping to your Actions?
Your action name contains some wildcard, then use that in your method with {1}
How you you dynamically substritue results using the Valuestack?
Notice our action stores ‘nextPage’ so it’s on the Valuestack. We then fetch whatever is in nextPage for our result (notice the ${expression} syntax because it’s in XML)
How can we preventr duplicate forms from being submitted?
Useing the token tag. Put it your form, Struts handles the rest.
Say you have a long running action, you want the user to know that it’s working and to be patient. What’s an easy built in way of doing this?
execAndWait, put this as the LAST filter on your stack (it stops running filters and calls the action directly)
Then it redirects user to a please wait page, and refreshes every 2 seconds. When process is complete then page will automatically return to normal!