1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.taglib;
18
19 import javax.servlet.jsp.PageContext;
20 import javax.servlet.jsp.tagext.SimpleTagSupport;
21
22 import com.fatwire.gst.foundation.controller.action.support.IcsFactoryUtil;
23
24 import COM.FutureTense.Interfaces.ICS;
25
26
27
28
29
30
31
32 public abstract class GsfSimpleTag extends SimpleTagSupport {
33
34 protected final ICS getICS() {
35 final Object o = getJspContext().getAttribute(GsfRootTag.ICS_VARIABLE_NAME, PageContext.PAGE_SCOPE);
36 if (o instanceof ICS) {
37 return (ICS) o;
38 }
39 throw new RuntimeException("Can't find ICS object on the page context.");
40 }
41
42 protected final PageContext getPageContext() {
43 return (PageContext) getJspContext();
44 }
45
46 protected final <T> T getService(String name, Class<T> type) {
47 return IcsFactoryUtil.getFactory(getICS()).getObject(name, type);
48 }
49
50 }