1
2
3 package com.pnpconsult.zeiterfassung.tags;
4
5 import java.net.MalformedURLException;
6
7 import javax.servlet.jsp.JspException;
8 import javax.servlet.jsp.tagext.TagSupport;
9
10 import org.apache.struts.util.RequestUtils;
11 import org.apache.struts.util.ResponseUtils;
12
13 /***
14 * @author <a href="mailto:powerpete@users.sf.net">Moritz Petersen </a>
15 * @version $Id: RefreshTag.java,v 1.1 2004/06/09 19:26:40 powerpete Exp $
16 *
17 * @jsp.tag name="refresh"
18 */
19 public class RefreshTag extends TagSupport
20 {
21 private String time;
22 private String anchor;
23 private String forward;
24 private String href;
25 private String page;
26 private String action;
27
28 public int doStartTag() throws JspException
29 {
30 try
31 {
32 String url = RequestUtils.computeURL(
33 pageContext,
34 forward,
35 href,
36 page,
37 action,
38 null,
39 anchor,
40 false);
41 ResponseUtils.write(
42 pageContext,
43 "<meta http-equiv=\"refresh\" content=\""
44 + time
45 + "; URL="
46 + url
47 + "\">");
48 }
49 catch (MalformedURLException e)
50 {
51 throw new JspException(e);
52 }
53 return EVAL_PAGE;
54 }
55
56 /***
57 * @jsp.attribute required="false" rtexprvalue="false"
58 */
59 public String getAction()
60 {
61 return action;
62 }
63
64 public void setAction(String action)
65 {
66 this.action = action;
67 }
68
69 /***
70 * @jsp.attribute required="false" rtexprvalue="false"
71 */
72 public String getAnchor()
73 {
74 return anchor;
75 }
76
77 public void setAnchor(String anchor)
78 {
79 this.anchor = anchor;
80 }
81
82 /***
83 * @jsp.attribute required="false" rtexprvalue="false"
84 */
85 public String getForward()
86 {
87 return forward;
88 }
89
90 public void setForward(String forward)
91 {
92 this.forward = forward;
93 }
94
95 /***
96 * @jsp.attribute required="false" rtexprvalue="false"
97 */
98 public String getHref()
99 {
100 return href;
101 }
102
103 public void setHref(String href)
104 {
105 this.href = href;
106 }
107
108 /***
109 * @jsp.attribute required="false" rtexprvalue="false"
110 */
111 public String getPage()
112 {
113 return page;
114 }
115
116 public void setPage(String page)
117 {
118 this.page = page;
119 }
120
121 /***
122 * @jsp.attribute required="false" rtexprvalue="false"
123 */
124 public String getTime()
125 {
126 return time;
127 }
128
129 public void setTime(String time)
130 {
131 this.time = time;
132 }
133 }