David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler

    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 223 other followers

  • Sleepless Nights…

    March 2006
    S M T W T F S
  • Blog Stats

    • 1,029,897 hits

JSF Tip of the Day: Immediate outcomes

Posted by David Chandler on March 30, 2006

Do you ever want to use a button to transition to another view, but don’t need to execute an event handler method? Common examples of this are Cancel and Finished buttons. Rather than writing a dummy method just to return an outcome string that matches a navigation rule, you can simply do this:

<h:commandButton value=”Finish” immediate=”true” action=”return_to_start”/>

When immediate=true, JSF skips the validation, update model, and invoke application phases, so no event handler methods are executed and you specify the outcome string in the action attribute where you would normally put a method binding. To select the next view, JSF will process navigation rules using the outcome as usual.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: