Source code: com/aendvari/tethys/tag/basic/PathTag.java
1 /*
2 * PathTag.java
3 *
4 * Copyright (c) 2001, 2002 Aendvari, Ltd. All Rights Reserved.
5 *
6 * See the file LICENSE for terms of use.
7 *
8 */
9
10 package com.aendvari.tethys.tag.basic;
11
12 import java.io.IOException;
13 import javax.servlet.http.*;
14 import javax.servlet.jsp.*;
15 import javax.servlet.jsp.tagext.*;
16
17 import com.aendvari.common.model.*;
18
19 import com.aendvari.tethys.*;
20 import com.aendvari.tethys.context.*;
21 import com.aendvari.tethys.tag.*;
22 import com.aendvari.tethys.tag.model.*;
23
24
25 /**
26 * <p>Implementation class for the "path" tag.</p>
27 *
28 * @author Scott Milne
29 *
30 */
31
32 public class PathTag extends ModelTreeTag
33 {
34 /* Variables */
35
36
37 /* Constructor */
38
39 public PathTag()
40 {
41 super();
42 }
43
44 public int doEndTag() throws JspTagException
45 {
46 try
47 {
48 // establish tag context
49 establishModelContext();
50
51 // set the tag value to return
52 String ls_output = modelContext.extendModelPath(path);
53
54 // for visual purposes, convert all "." into "/"
55 // OSM supports both, but it looks better to have all the same
56 ls_output = ls_output.replace('.', '/');
57
58 // output whatever "string" we want to produce back to the user
59 pageContext.getOut().write(ls_output.trim());
60 }
61 catch (IOException e)
62 {
63 throw new JspTagException("PathTag:" + e.toString());
64 }
65
66 // Have the JSP Container continue the JSP page as normal
67 return EVAL_PAGE;
68 }
69 }
70