Rev 1310 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
215 | jmachado | 1 | package pt.estgp.estgweb.web.tags; |
2 | |||
3 | import org.apache.log4j.Logger; |
||
4 | |||
5 | import javax.servlet.jsp.tagext.BodyTagSupport; |
||
6 | import javax.servlet.jsp.JspException; |
||
7 | import javax.servlet.jsp.JspWriter; |
||
8 | |||
9 | import pt.estgp.estgweb.domain.UserSessionImpl; |
||
1814 | jmachado | 10 | import pt.estgp.estgweb.utils.Globals; |
215 | jmachado | 11 | import pt.estgp.estgweb.utils.ConfigProperties; |
12 | |||
13 | public class IsModuleOnTag extends BodyTagSupport |
||
14 | { |
||
15 | |||
16 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(IsModuleOnTag.class); |
||
17 | |||
18 | |||
19 | private 1.5.0/docs/api/java/lang/String.html">String module; |
||
20 | |||
21 | |||
22 | public 1.5.0/docs/api/java/lang/String.html">String getModule() |
||
23 | { |
||
24 | return module; |
||
25 | } |
||
26 | |||
27 | public void setModule(1.5.0/docs/api/java/lang/String.html">String module) |
||
28 | { |
||
29 | this.module = module; |
||
30 | } |
||
31 | |||
32 | public int doStartTag() throws JspException |
||
33 | { |
||
34 | if(go()) |
||
35 | return EVAL_BODY_TAG; |
||
36 | else |
||
37 | return SKIP_BODY; |
||
38 | } |
||
39 | |||
40 | public boolean go() |
||
41 | { |
||
42 | return ConfigProperties.getBooleanProperty(Globals.MODULE_STATUS_PREFIX + module); |
||
43 | } |
||
44 | |||
45 | public int doEndTag() throws JspException |
||
46 | { |
||
47 | if (go()) |
||
48 | { |
||
49 | 1.5.0/docs/api/java/lang/String.html">String toPage = bodyContent.getString().trim(); |
||
50 | JspWriter writer = pageContext.getOut(); |
||
51 | try |
||
52 | { |
||
53 | writer.write(toPage); |
||
54 | } |
||
55 | catch (1.5.0/docs/api/java/lang/Exception.html">Exception e) |
||
56 | { |
||
57 | logger.error(e, e); |
||
58 | throw new JspException(e); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | // Continue processing this page |
||
63 | return EVAL_PAGE; |
||
64 | } |
||
65 | |||
66 | |||
67 | } |