20.04.2013 Views

Practical RichFaces, Second Edition

Practical RichFaces, Second Edition

Practical RichFaces, Second Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 2 GETTING STARTED<br />

INFO: BEFORE PROCESS_VALIDATIONS 3<br />

Feb 8, 2011 2:39:49 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER PROCESS_VALIDATIONS 3<br />

Feb 8, 2011 2:39:49 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: BEFORE RENDER_RESPONSE 6<br />

Feb 8, 2011 2:39:49 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER RENDER_RESPONSE 6<br />

We arrived at Phase 3, validation failed and we jumped to Phase 6. So far it all makes sense. Now<br />

enter a valid value either for name or age. You should now see the console shown in Listing 2-41.<br />

Listing 2-41. After entering a valid value, you will see the following console<br />

INFO: BEFORE RESTORE_VIEW 1<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER RESTORE_VIEW 1<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: BEFORE APPLY_REQUEST_VALUES 2<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER APPLY_REQUEST_VALUES 2<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: BEFORE PROCESS_VALIDATIONS 3<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER PROCESS_VALIDATIONS 3<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: BEFORE UPDATE_MODEL_VALUES 4<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER UPDATE_MODEL_VALUES 4<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: BEFORE INVOKE_APPLICATION 5<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER INVOKE_APPLICATION 5<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: BEFORE RENDER_RESPONSE 6<br />

Feb 8, 2011 2:41:23 PM org.apache.catalina.core.ApplicationContext log<br />

INFO: AFTER RENDER_RESPONSE 6<br />

As validation didn’t fail, we competed all the phases. The next question is: do we need to go through<br />

all the phases when we are only validating? Probably not. When only validating, it’s enough to reach<br />

Phase 3 (Process Validations), and even if the input is correct we can jump to the Render Response<br />

phase. Why invoke the Update Model and Invoke Application phases when we actually don’t need to?<br />

Let’s make our request quicker.<br />

When the Register button is clicked, we don’t want to go through all the phases, we want to skip<br />

Update Model and Invoke Application phases. How do we achieve that? That’s where the bypassUpdates<br />

attribute is going to help us and described in Table 2-9.<br />

Table 2-9. bypassUpdates attribute<br />

Attribute Description<br />

bypassUpdates Skips Update Model and Invoke Application phases, useful for form validation.<br />

Listing 2-42 shows updating the JSF page and setting bypassUpdates="true".

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!