/** * We are overriding this tag, because Stripes will call this method on doStartTag() method, and * on doEndInputTag() method, stripes will render all registered field, and on binding, Stripes * will set all missing fields in the request with null. We dont want this behaviour on the fields * that we set to read-only. We dont want those fields to be registered in the first place, so * that Stripes mechanism to set missing fields wont set those fields. * * @see * net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder#bind(net.sourceforge.stripes.action.ActionBean, * net.sourceforge.stripes.action.ActionBeanContext, boolean) * @see * net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder#bindMissingValuesAsNull(net.sourceforge.stripes.action.ActionBean, * net.sourceforge.stripes.action.ActionBeanContext) * @throws StripesJspException */ protected void registerWithParentForm() throws StripesJspException { NCFieldPermission ncFieldPermission = helper.getFieldPermission(getName()); switch (ncFieldPermission) { case Write: super.registerWithParentForm(); break; default: LOG.debug( MessageFormat.format( "Not registering field [{0}] as user doesnt have write access", getName())); } }
public int doStartTag() throws JspException { NCFieldPermission ncFieldPermission = helper.getFieldPermission(getName()); switch (ncFieldPermission) { case Write: case Read: return EVAL_BODY_INCLUDE; case None: return SKIP_BODY; default: throw new IllegalArgumentException("Invalid field permission " + ncFieldPermission); } }
public int doEndInputTag() throws JspException { NCFieldPermission ncFieldPermission = helper.getFieldPermission(getName()); switch (ncFieldPermission) { case Write: return super.doEndInputTag(); case Read: writeAsSpanLabel(); return EVAL_PAGE; case None: return EVAL_PAGE; default: throw new IllegalArgumentException("Invalid field permission " + ncFieldPermission); } }