01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.taglib.providerContext;
06:
07: import javax.servlet.jsp.JspException;
08: import java.util.Hashtable;
09:
10: import com.sun.portal.providers.Provider;
11: import com.sun.portal.providers.context.ProviderContext;
12: import com.sun.portal.providers.context.ProviderContextException;
13:
14: import com.sun.portal.desktop.taglib.DesktopTaglibException;
15:
16: public class GetTemplateTag extends BaseProviderContextTagSupport {
17: private String m_file = null;
18: private Hashtable m_table = null;
19:
20: public void setFile(String file) throws DesktopTaglibException {
21: m_file = resolveParameter(file).toString();
22: }
23:
24: public void setTable(String table) throws DesktopTaglibException {
25: m_table = (Hashtable) resolveParameter(table);
26: }
27:
28: public int doStartTag() throws JspException {
29: ProviderContext pc = getCurrentProviderContext();
30: StringBuffer sb = null;
31: Provider p = getCurrentObj();
32: try {
33: if (m_table == null) {
34: sb = pc.getTemplate(p.getName(), m_file);
35: } else {
36: sb = pc.getTemplate(p.getName(), m_file, m_table);
37: }
38: } catch (ProviderContextException pce) {
39: throw new DesktopTaglibException(pce);
40: }
41: processResult(sb);
42: return SKIP_BODY;
43: }
44: }
|