The action defined in <on-render> is executed before the view is rendered.
The distinction seems very clear but in practice, say you need to load some information from the database to be displayed, will you use <on-entry> or <on-render>?
Both seem to be legitimate choices. Does it really matter if the data is loaded upon entry or right before the view is rendered?
Well, the answer depends on whether you want the data to be reloaded if the page gets refreshed (including partially refreshed).
Let's see an example.
In web-flow.xml, we have a view-state.
<view-state id="dummy"> <on-entry> <evaluate expression="dummy.onEntry()"></evaluate> </on-entry> <on-render> <evaluate expression="dummy.onRender()"></evaluate> </on-render> </view-state>
Dummy.java
public class Dummy implements Serializable{ private static final long serialVersionUID = 1L; public void onRender(){ System.out.println("On Render"); } public void onEntry(){ System.out.println("On Entry"); } }
After the view is rendered on the browser, we will see in the console
On Entry On Render
Now we refresh the page (i.e. press F5), we will see in the console
On Entry On Render On Render
So the on-entry action wouldn't be executed but on-render action still would.