1 9 package org.jboss.portal.portlet.taglib; 10 11 import java.io.IOException ; 12 13 import javax.servlet.jsp.JspException ; 14 15 import org.jboss.portal.server.Instance; 16 import org.jboss.portal.server.Window; 17 import org.jboss.portal.server.invocation.AttachmentKey; 18 import org.jboss.portal.server.invocation.Invocation; 19 20 38 public class NamespaceTag extends PortletTag 39 { 40 41 public int doStartTag() throws JspException 42 { 43 return SKIP_BODY; 44 } 45 46 public int doEndTag() throws JspException 47 { 48 Invocation invocation = getInvocation(); 49 50 Window window = (Window)invocation.getAttachment(AttachmentKey.WINDOW); 51 Instance instance = (Instance)window.getInstance(); 52 try 53 { 54 String baseString = instance.toString(); 56 int atPos = baseString.indexOf("@"); 57 int lastDotPos = baseString.lastIndexOf("."); 58 59 String instanceId = baseString.substring(atPos + 1); 60 String className = baseString.substring(lastDotPos + 1, atPos); 61 62 64 pageContext.getOut().print("_" + className + "_" + instanceId); 65 } 66 catch (IOException e) 67 { 68 e.printStackTrace(); 69 } 70 return EVAL_PAGE; 71 } 72 } 73 | Popular Tags |