1
//******************************************************************************
3
* Copyright (c) 2002-2003 FOS Software Corporation. All Rights Reserved.
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.
9
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
10
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
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.
21
//******************************************************************************
22
package cn.com.fos.application.web.jsp.taglib.html;
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;
32
* FosMessageTag Class File <BR>
36
public class FosMessageTag extends FosTagSupport {
39
private String messageKey = null;
42
private String classStyle = null;
45
* Get Class Style <BR>
48
public String getClassStyle() {
53
* Set Class Style <BR>
56
public void setClassStyle(String classStyle) {
57
this.classStyle = classStyle;
64
public String getMessageKey() {
72
public void setMessageKey(String messageKey) {
73
this.messageKey = messageKey;
79
* @throws javax.servlet.jsp.JspException JspException
81
public int doStartTag() throws JspException {
82
return EVAL_BODY_INCLUDE;
88
* @throws javax.servlet.jsp.JspException JspException
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));
99
List messages = message.getMessageList();
100
for (int i0 = 0; i0 < messages.size(); i0++) {
101
appendMessage(buffer, (String)messages.get(i0));
104
buffer.append("</table>");
106
pageContext.getOut().write(buffer.toString());
107
} catch (IOException ex) {
108
throw new JspException(ex.toString());
115
* Set MEssage to buffer <BR>
116
* @param buffer buffer
117
* @param argMessage message
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>");
b'\\ No newline at end of file'