@Override protected void doTag(BufferResult capturedBody, Writer out) throws JspTagException, IOException { if(name == null) throw new AttributeRequiredException("name"); Node resolvedTarget; if(target != null) { resolvedTarget = target; } else { resolvedTarget = CurrentNode.getCurrentNode(((PageContext)getJspContext()).getRequest()); if(resolvedTarget == null) throw new JspTagException("Unable to find parent node for property target"); } String propertyName = Coercion.toString(name); boolean propertySet = resolvedTarget.setProperty( propertyName, valueSet ? value : capturedBody.trim() ); if(!propertySet && !allowExisting) { throw new LocalizedJspTagException( ApplicationResources.accessor, "error.duplicateDynamicElementProperty", propertyName ); } } }
/** * @see TextInXhtmlEncoder * * @param value the value to be encoded */ public ChainWriter encodeXhtml(Object value) throws IOException { if(value!=null) { if( value instanceof Writable && !((Writable)value).isFastToString() ) { // Avoid unnecessary toString calls Coercion.write(value, textInXhtmlEncoder, out); } else { String str = Coercion.toString(value); BundleLookupMarkup lookupMarkup; BundleLookupThreadContext threadContext = BundleLookupThreadContext.getThreadContext(false); if(threadContext!=null) { lookupMarkup = threadContext.getLookupMarkup(str); } else { lookupMarkup = null; } if(lookupMarkup!=null) lookupMarkup.appendPrefixTo(MarkupType.XHTML, out); textInXhtmlEncoder.write(str, out); if(lookupMarkup!=null) lookupMarkup.appendSuffixTo(MarkupType.XHTML, out); } } return this; }
textInJavaScriptEncoder.writeSuffixTo(javaScriptInXhtmlWriter); } else { String str = Coercion.toString(value); BundleLookupMarkup lookupMarkup; BundleLookupThreadContext threadContext = BundleLookupThreadContext.getThreadContext(false);
textInJavaScriptEncoder.writeSuffixTo(javaScriptInXhtmlAttributeWriter); } else { String str = Coercion.toString(value); BundleLookupMarkup lookupMarkup; BundleLookupThreadContext threadContext = BundleLookupThreadContext.getThreadContext(false);