HiddenTag hiddenTag = new HiddenTag(); String name = attributes.get( NAME );
@Override protected Tag createReadOnlyLabelTag( Map<String, String> attributes, MetawidgetTag metawidget ) { HiddenTag tag = new HiddenTag(); String name = attributes.get( NAME ); if ( metawidget.getPathPrefix() != null ) { name = metawidget.getPathPrefix() + name; } tag.setProperty( name ); tag.setWrite( true ); // Note: according to STR-1305 we'll get a proper html:label tag with Struts 1.4.0, so we // can use it instead of a HiddenTag with .setDisabled( true ) tag.setDisabled( true ); // org.apache.struts.taglib.html.HiddenTag will output a disabled <hidden> tag. If // tag.setWrite( true ) doesn't output anything additional (i.e. the field has no value) // then it'll look to HtmlTableLayout like this should be placed outside the table along // with all the other <hidden> fields. Output a SPAN tag to stop this. try { String literal = JspUtils.writeTag( metawidget.getPageContext(), tag, metawidget ); if ( JspUtils.isJustHiddenFields( literal ) ) { return new LiteralTag( literal + "<span></span>" ); } return new LiteralTag( literal ); } catch ( JspException e ) { throw WidgetBuilderException.newException( e ); } }