當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionMessage.getKey方法代碼示例

本文整理匯總了Java中org.apache.struts.action.ActionMessage.getKey方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionMessage.getKey方法的具體用法?Java ActionMessage.getKey怎麽用?Java ActionMessage.getKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.struts.action.ActionMessage的用法示例。


在下文中一共展示了ActionMessage.getKey方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doAfterBody

import org.apache.struts.action.ActionMessage; //導入方法依賴的package包/類
/**
 * Make the next collection element available and loop, or
 * finish the iterations if there are no more elements.
 *
 * @exception JspException if a JSP exception has occurred
 */
public int doAfterBody() throws JspException {
    // Render the output from this iteration to the output stream
    if (bodyContent != null) {
        TagUtils.getInstance().writePrevious(pageContext, bodyContent.getString());
        bodyContent.clearBody();
    }

    // Decide whether to iterate or quit
    if (iterator.hasNext()) {
        ActionMessage report = (ActionMessage) iterator.next();
        String msg = null;
        if (report.isResource()) {
            msg = TagUtils.getInstance().message(
                pageContext,
                bundle,
                locale,
                report.getKey(),
                report.getValues());
        } else {
            msg = report.getKey();
        }

       if (msg == null) {
           pageContext.removeAttribute(id);
       } else {
           pageContext.setAttribute(id, msg);
       }

       return (EVAL_BODY_TAG);
    } else {
       return (SKIP_BODY);
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:41,代碼來源:MessagesTag.java

示例2: doStartTag

import org.apache.struts.action.ActionMessage; //導入方法依賴的package包/類
public int doStartTag() throws JspException {
       ActionMessages errors = null;

       try {
           errors = TagUtils.getInstance().getActionMessages(pageContext, Globals.ERROR_KEY);
       } catch (JspException e) {
           TagUtils.getInstance().saveException(pageContext, e);
           throw e;
       }
       
       String hint = null;
       if (errors != null && !errors.isEmpty()) {
       	 String message = null;
            Iterator reports = (getProperty() == null ? errors.get() : errors.get(getProperty()));
            while (reports.hasNext()) {
           	 ActionMessage report = (ActionMessage) reports.next();
           	 if (report.isResource()) {
           		 message = TagUtils.getInstance().message(pageContext, null, Globals.LOCALE_KEY, report.getKey(), report.getValues());
           	 } else {
           		 message = report.getKey();
           	 }
           	 if (message != null && !message.isEmpty()) {
           		 hint = (hint == null ? "" : hint + "<br>") + message;
           	 }
            }
       }
       
	// setStyleClass("unitime-DateSelectionBox");
	String onchange = getOnchange(); setOnchange(null);
	TagUtils.getInstance().write(pageContext, "<span name='UniTimeGWT:CourseNumberSuggestBox' configuration=\"" + getConfiguration() + "\"" +
			(hint == null ? "" : " error=\"" + hint + "\"") +
			(onchange == null ? "" : " onchange=\"" + onchange + "\"") +
			(getOuterStyle() == null ? "" : " style=\"" + getOuterStyle() + "\"" ) +
			">");
	super.doStartTag();
	TagUtils.getInstance().write(pageContext, "</span>");
	return EVAL_BODY_BUFFERED;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:39,代碼來源:CourseNumberSuggestBox.java

示例3: doStartTag

import org.apache.struts.action.ActionMessage; //導入方法依賴的package包/類
public int doStartTag() throws JspException {
       ActionMessages errors = null;

       try {
           errors = TagUtils.getInstance().getActionMessages(pageContext, Globals.ERROR_KEY);
       } catch (JspException e) {
           TagUtils.getInstance().saveException(pageContext, e);
           throw e;
       }
       
       String hint = null;
       if (errors != null && !errors.isEmpty()) {
       	 String message = null;
            Iterator reports = (getProperty() == null ? errors.get() : errors.get(getProperty()));
            while (reports.hasNext()) {
           	 ActionMessage report = (ActionMessage) reports.next();
           	 if (report.isResource()) {
           		 message = TagUtils.getInstance().message(pageContext, null, Globals.LOCALE_KEY, report.getKey(), report.getValues());
           	 } else {
           		 message = report.getKey();
           	 }
           	 if (message != null && !message.isEmpty()) {
           		 hint = (hint == null ? "" : hint + "<br>") + message;
           	 }
            }
       }
       
	setStyleClass("unitime-DateSelectionBox");
	String onchange = getOnchange(); setOnchange(null);
	TagUtils.getInstance().write(pageContext, "<span name='UniTimeGWT:Calendar' format=\"" + getFormat() + "\"" +
			(hint == null ? "" : " error=\"" + hint + "\"") +
			(onchange == null ? "" : " onchange=\"" + onchange + "\"") +
			(getOuterStyle() == null ? "" : " style=\"" + getOuterStyle() + "\"" ) +
			">");
	super.doStartTag();
	TagUtils.getInstance().write(pageContext, "</span>");
	return EVAL_BODY_BUFFERED;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:39,代碼來源:Calendar.java

示例4: doStartTag

import org.apache.struts.action.ActionMessage; //導入方法依賴的package包/類
/**
 * Construct an iterator for the specified collection, and begin
 * looping through the body once per element.
 *
 * @exception JspException if a JSP exception has occurred
 */
public int doStartTag() throws JspException {
    // Initialize for a new request.
    processed = false;

    // Were any messages specified?
    ActionMessages messages = null;

    // Make a local copy of the name attribute that we can modify.
    String name = this.name;

    if (message != null && "true".equalsIgnoreCase(message)) {
        name = Globals.MESSAGE_KEY;
    }

    try {
        messages = TagUtils.getInstance().getActionMessages(pageContext, name);

    } catch (JspException e) {
        TagUtils.getInstance().saveException(pageContext, e);
        throw e;
    }

    // Acquire the collection we are going to iterate over
    this.iterator = (property == null) ? messages.get() : messages.get(property);

    // Store the first value and evaluate, or skip the body if none
    if (!this.iterator.hasNext()) {
        return SKIP_BODY;
    }

    ActionMessage report = (ActionMessage) this.iterator.next();
    String msg = null;
    if (report.isResource()) {
        msg = TagUtils.getInstance().message(
                 pageContext,
                 bundle,
                 locale,
                 report.getKey(),
                 report.getValues());
    } else {
        msg = report.getKey();
    }

    if (msg == null) {
        pageContext.removeAttribute(id);
    } else {
        pageContext.setAttribute(id, msg);
    }

    if (header != null && header.length() > 0) {
        String headerMessage =
            TagUtils.getInstance().message(pageContext, bundle, locale, header);

        if (headerMessage != null) {
            TagUtils.getInstance().write(pageContext, headerMessage);
        }
    }

    // Set the processed variable to true so the
    // doEndTag() knows processing took place
    processed = true;

    return (EVAL_BODY_TAG);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:71,代碼來源:MessagesTag.java


注:本文中的org.apache.struts.action.ActionMessage.getKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。