I'm designing a custom component in JSF after I decided that the task to be solve is way too complicated for a composite component and started with the following approach:
@FacesComponent("offervaluescustom")
public class OfferValuesCustom extends UIComponentBase {
@Override
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("table", this);
//a lof of code
writer.endElement("table");
}
}
I'm using PrimeFaces as JSF implementation and was wondering how I could write an element to the response writer programmatically instead of copying the generated HTML code which is a valid workaround, but not portable and an unnecessary repitition of work.
The reason I'm using a recursive component is conditional spanning of columns in some rows, but not in others, as well as difficult recursion which is trivial in encodeBegin
, but complex in cc:implementation
because of scope issues (render vs. view).