~hongzhi-wu-sh/jnetfs/trunk

« back to all changes in this revision

Viewing changes to FOS-LE/src/cn/com/fos/application/web/jsp/taglib/html/FosMessageTag.java

  • Committer: Jacky WU
  • Date: 2010-09-04 13:54:18 UTC
  • Revision ID: jacky@laptop-20100904135418-6e5x72cftn06mnhx
add ipod fs support

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//******************************************************************************
2
 
/*
3
 
 * Copyright (c) 2002-2003 FOS Software Corporation. All Rights Reserved.
4
 
 *
5
 
 * This SOURCE CODE FILE, which has been provided by FOS Software as part
6
 
 * of an FOS Software product for use ONLY by licensed users of the product,
7
 
 * includes CONFIDENTIAL and PROPRIETARY information of FOS Software.
8
 
 *
9
 
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
10
 
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
11
 
 * THE PRODUCT.
12
 
 *
13
 
 * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD FOS SOFTWARE, ITS
14
 
 * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
15
 
 * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
16
 
 * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
17
 
 * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
18
 
 * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
19
 
 * DERIVED FROM THIS SOURCE CODE FILE.
20
 
 */
21
 
//******************************************************************************
22
 
package cn.com.fos.application.web.jsp.taglib.html;
23
 
 
24
 
import java.io.IOException;
25
 
import java.util.List;
26
 
import cn.com.fos.application.services.application.FosMessageData;
27
 
import cn.com.fos.application.web.jsp.taglib.FosTagSupport;
28
 
import cn.com.fos.application.web.servlet.FosWebConst;
29
 
import javax.servlet.jsp.JspException;
30
 
 
31
 
/**
32
 
 * FosMessageTag Class File <BR>
33
 
 * @author wuhongzhi
34
 
 * @version 0.1
35
 
 */
36
 
public class FosMessageTag extends FosTagSupport {
37
 
 
38
 
  /** message key */
39
 
  private String messageKey = null;
40
 
 
41
 
  /** style */
42
 
  private String classStyle = null;
43
 
 
44
 
  /**
45
 
   * Get Class Style <BR>
46
 
   * @return String
47
 
   */
48
 
  public String getClassStyle() {
49
 
    return classStyle;
50
 
  }
51
 
 
52
 
  /**
53
 
   * Set Class Style <BR>
54
 
   * @param classStyle
55
 
   */
56
 
  public void setClassStyle(String classStyle) {
57
 
    this.classStyle = classStyle;
58
 
  }
59
 
 
60
 
  /**
61
 
   * Get Message <BR>
62
 
   * @return Message
63
 
   */
64
 
  public String getMessageKey() {
65
 
    return messageKey;
66
 
  }
67
 
 
68
 
  /**
69
 
   * Set Message <BR>
70
 
   * @param messageKey
71
 
   */
72
 
  public void setMessageKey(String messageKey) {
73
 
    this.messageKey = messageKey;
74
 
  }
75
 
 
76
 
  /**
77
 
   * Start Tag <BR>
78
 
   * @return int
79
 
   * @throws javax.servlet.jsp.JspException JspException
80
 
   */
81
 
  public int doStartTag() throws JspException {
82
 
    return EVAL_BODY_INCLUDE;
83
 
  }
84
 
 
85
 
  /**
86
 
   * End Tag <BR>
87
 
   * @return INT
88
 
   * @throws javax.servlet.jsp.JspException JspException
89
 
   */
90
 
  public int doEndTag() throws JspException {
91
 
    FosMessageData message =
92
 
        (FosMessageData)pageContext.getRequest().getAttribute(FosWebConst.fosMessage);
93
 
    if (message != null) {
94
 
      StringBuffer buffer = new StringBuffer();
95
 
      buffer.append("<table width=100% cellpadding=1>");
96
 
      if (messageKey != null) {
97
 
        appendMessage(buffer, message.getMessage(messageKey));
98
 
      } else {
99
 
        List messages = message.getMessageList();
100
 
        for (int i0 = 0; i0 < messages.size(); i0++) {
101
 
          appendMessage(buffer, (String)messages.get(i0));
102
 
        }
103
 
      }
104
 
      buffer.append("</table>");
105
 
      try {
106
 
        pageContext.getOut().write(buffer.toString());
107
 
      } catch (IOException ex) {
108
 
        throw new JspException(ex.toString());
109
 
      }
110
 
    }
111
 
    return EVAL_PAGE;
112
 
  }
113
 
 
114
 
  /**
115
 
   * Set MEssage to buffer <BR>
116
 
   * @param buffer buffer
117
 
   * @param argMessage message
118
 
   */
119
 
  private void appendMessage(StringBuffer buffer, String argMessage) {
120
 
    if (argMessage != null) {
121
 
      buffer.append("<tr><td class=\"" + classStyle + "\">");
122
 
      buffer.append(argMessage);
123
 
      buffer.append("</td></tr>");
124
 
    }
125
 
  }
126
 
}
 
 
b'\\ No newline at end of file'