OpenmrsMessageTag.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:openmrs-module-legacyui 作者:
/**
 * @see MessageTag#doStartTagInternal()
 * @should evaluate specified message resolvable
 * @should resolve message by code
 * @should resolve message in locale that different from default
 * @should return code if no message resolved
 * @should use body content as fallback if no message resolved
 * @should use text attribute as fallback if no message resolved
 * @should use body content in prior to text attribute as fallback if no message resolved
 * @should ignore fallbacks if tag locale differs from context locale
 */
@Override
protected int doEndTagInternal() throws JspException, IOException {
    try {
        // Resolve the unescaped message.
        String msg = resolveMessage();

        // HTML and/or JavaScript escape, if demanded.
        msg = isHtmlEscape() ? HtmlUtils.htmlEscape(msg) : msg;
        msg = this.javaScriptEscape ? JavaScriptUtils.javaScriptEscape(msg) : msg;

        // Expose as variable, if demanded, else write to the page.
        String resolvedVar = this.var;
        if (resolvedVar != null) {
            pageContext.setAttribute(resolvedVar, msg, TagUtils.getScope(this.scope));
        } else {
            writeMessage(msg);
        }

        return EVAL_PAGE;
    }
    catch (NoSuchMessageException ex) {
        throw new JspTagException(getNoSuchMessageExceptionDescription(ex));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号