/** * Complete the processing of the tag. The nested tags here will restore * all the original value for the tag itself and the nesting context. * @return int to describe the next step for the JSP processor * @throws JspException for the bad things JSP's do */ public int doEndTag() throws JspException { // do the super's ending part int i = super.doEndTag(); // reset the properties setName(originalName); setProperty(originalProperty); setLabelProperty(originalLabelProperty); // continue return i; }
/** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. * @return int JSP continuation directive. * This is in the hands of the super class. */ public int doStartTag() throws JspException { // get the original properties originalName = getName(); originalProperty = getProperty(); originalLabelProperty = getLabelProperty(); // request HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); // if we have a label property if (originalLabelProperty != null) { // do the label property first if (getName() == null|| Constants.BEAN_KEY.equals(getName())) { super.setLabelProperty(NestedPropertyHelper.getAdjustedProperty(request, originalLabelProperty)); } else { super.setLabelProperty(originalLabelProperty); } } // set the other properties NestedPropertyHelper.setNestedProperties(request, this); // let the super do it's thing return super.doStartTag(); }
private Tag createSelectTag( String name, String property, Map<String, String> attributes ) { // Select tag SelectTag select = new SelectTag(); // Empty option (if needed) if ( WidgetBuilderUtils.needsEmptyLookupItem( attributes ) ) { OptionTag emptyOption = new OptionTag(); emptyOption.setValue( "" ); JspUtils.addDeferredChild( select, emptyOption ); } // Options tag OptionsTag optionsTag = new OptionsTag(); optionsTag.setName( name ); optionsTag.setProperty( property ); // Optional labelName and labelProperty String labelName = attributes.get( STRUTS_LOOKUP_LABEL_NAME ); if ( labelName != null ) { optionsTag.setLabelName( labelName ); } String labelProperty = attributes.get( STRUTS_LOOKUP_LABEL_PROPERTY ); if ( labelProperty != null ) { optionsTag.setLabelProperty( labelProperty ); } JspUtils.addDeferredChild( select, optionsTag ); return select; }