KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > deprecated > taglibs > field > page > PageTitleTag


1 package org.jahia.deprecated.taglibs.field.page;
2
3 import javax.servlet.ServletRequest JavaDoc;
4 import javax.servlet.jsp.JspException JavaDoc;
5
6 import org.jahia.data.JahiaData;
7 import org.jahia.gui.GuiBean;
8
9
10 /**
11  * Class PageTitleTag : displays the title of the current page field;
12  * This tag must be enclosed in the PageFieldTag.
13  *
14  * @author Jerome Tamiotti
15  */

16 public class PageTitleTag extends PageFieldAbstract {
17
18     private int maxchar = 0;
19
20     public void setMaxchar(int maxchar) {
21         this.maxchar = maxchar;
22     }
23
24     public String JavaDoc getField() {
25
26         ServletRequest JavaDoc request = pageContext.getRequest();
27         JahiaData jData = (JahiaData) request.getAttribute("org.jahia.data.JahiaData");
28         if (this.maxchar == 0) {
29             return thePage.getTitle();
30         } else {
31             return GuiBean.glueTitle(thePage.getTitle(), this.maxchar);
32         }
33     }
34
35        public int doEndTag() throws JspException JavaDoc {
36            // let's reinitialize the tag variables to allow tag object reuse in
37
// pooling.
38
super.doEndTag();
39            maxchar = 0;
40            return EVAL_PAGE;
41        }
42
43 }
44
45
Popular Tags