JSF

Handpicked high quality answers to everything you need to know about JavaServer Faces (JSF). ZEEF itself is also developed in JSF. In fact, Bauke Scholtz himself has developed the majority of the front-end of ZEEF (except of the Dashboard).

by Bauke Scholtz

Bauke Scholtz is also known as “BalusC” in many online communities, such as Stack Overflow.

JSF phases/lifecycle cheatsheet

  • fc = FacesContext
  • vh = ViewHandler
  • in = UIInput
  • rq = HttpServletRequest
  • id = in.getClientId(fc);

1 RESTORE_VIEW

String viewId = rq.getServletPath();
fc.setViewRoot(vh.createView(fc, viewId));

2 APPLY_REQUEST_VALUES

in.setSubmittedValue(rq.getParameter(id));

3 PROCESS_VALIDATIONS

Object value = in.getSubmittedValue();
try {
   value = in.getConvertedValue(fc, value);
   for (Validator v : in.getValidators())
      v.validate(fc, in, value);
   }
   in.setSubmittedValue(null);
   in.setValue(value);
} catch (ConverterException
   | ValidatorException e) {
   fc.addMessage(id, e.getFacesMessage());
   fc.validationFailed(); // Skips phases 4+5.
   in.setValid(false);
}

4 UPDATE_MODEL_VALUES

bean.setProperty(in.getValue());

5 INVOKE_APPLICATION

bean.submit();

6 RENDER_RESPONSE

vh.renderView(fc, fc.getViewRoot());

Some ZEEF facts

ZEEF is itself also developed in JSF. It’s currently using Mojarra 2.1.26, PrimeFaces 4.0 and OmniFaces 1.8-SNAPSHOT (with CDI @ViewScoped!).

You should on ZEEF never face the dreaded ViewExpiredException when you’re not logged-in, or when you’re logged-in with “Remember me” ticked. Disclaimer, “should”; there are some rarely used features where this needs to be fixed yet.

You can as page owner drag’n’drop blocks across the page and links across blocks.

ZEEF resolves newly added links asynchronously and uses for non-existing links Server-Sent Events to push the resolved title and favicon back to the client. SSE isn’t supported in IE until IE12; IE<=11 users need to refresh themselves.

Share your passion

Start your own subject now!

last updated at 19 April 2014 – 184 links – 27 blocks
Confirm
Follow page
Suggest new link
Suggest new link block
Mail Bauke Scholtz