1
2
3
4
5 package net.stff.util.tags;
6
7 import javax.servlet.http.HttpServletRequest;
8 import javax.servlet.jsp.JspException;
9 import javax.servlet.jsp.tagext.Tag;
10 import javax.servlet.jsp.tagext.TagSupport;
11
12 import net.stff.util.SessionObject;
13
14
15 /***
16 * @author buntekuh
17 *
18 */
19 /***
20 * @author buntekuh
21 *
22 * Allows the SessionObject to be used from within a JSP page. Retrieves a Bean found under the given name, then stores it using the name in the pageContext.
23 */
24 public class SessionObjectTag extends TagSupport {
25
26 private String name;
27
28 /***
29 * @param name The name to set.
30 */
31 public void setName(String name) {
32 this.name = name;
33 }
34 public int doStartTag() throws JspException{
35 return Tag.SKIP_BODY;
36 }
37
38 public int doEndTag() throws JspException{
39 SessionObject so = SessionObject.get((HttpServletRequest)pageContext.getRequest());
40 pageContext.setAttribute(name, so.getObject(name, (HttpServletRequest)pageContext.getRequest()));
41 return Tag.SKIP_BODY;
42 }
43 }