1 package org.jahia.deprecated.taglibs.util; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletRequest ; 6 import javax.servlet.jsp.JspException ; 7 import javax.servlet.jsp.JspWriter ; 8 import javax.servlet.jsp.tagext.TagSupport ; 9 10 import org.jahia.data.JahiaData; 11 import org.jahia.gui.GuiBean; 12 import org.jahia.utils.JahiaConsole; 13 14 15 20 public class CurrentPageTitleTag extends TagSupport { 21 22 private int maxchar = 0; 23 24 public void setMaxchar(int maxchar) { 25 this.maxchar = maxchar; 26 } 27 28 public int doStartTag() { 29 30 ServletRequest request = pageContext.getRequest(); 31 JahiaData jData = (JahiaData) request.getAttribute("org.jahia.data.JahiaData"); 32 try { 33 JspWriter out = pageContext.getOut(); 34 if (this.maxchar == 0) { 35 out.print( jData.page().getTitle() ); 36 } else { 37 out.print( GuiBean.glueTitle(jData.page().getTitle(), this.maxchar) ); 38 } 39 } catch (IOException ioe) { 40 JahiaConsole.println("CurrentPageTitleTag: doStartTag ", ioe.toString()); 41 } 42 return SKIP_BODY; 43 } 44 45 public int doEndTag() throws JspException { 46 maxchar = 0; 49 return EVAL_PAGE; 50 } 51 52 } 53 | Popular Tags |