1 9 package org.jboss.portal.core.theme.tag.basic; 10 11 import org.jboss.portal.server.WindowURL; 12 import org.jboss.portal.server.plugins.mode.Mode; 13 import org.jboss.portal.server.plugins.windowstate.WindowState; 14 15 import javax.servlet.jsp.tagext.TagSupport ; 16 import javax.servlet.jsp.JspException ; 17 import javax.servlet.jsp.JspWriter ; 18 import javax.servlet.jsp.JspTagException ; 19 import java.io.IOException ; 20 21 25 public class URLTag extends TagSupport 26 { 27 28 private String mode; 29 30 31 private String windowState; 32 33 public String getMode() 34 { 35 return mode; 36 } 37 38 public void setMode(String mode) 39 { 40 this.mode = mode; 41 } 42 43 public String getWindowState() 44 { 45 return windowState; 46 } 47 48 public void setWindowState(String windowState) 49 { 50 this.windowState = windowState; 51 } 52 53 public int doStartTag() throws JspException 54 { 55 IterateTag other = (IterateTag)findAncestorWithClass(this, IterateTag.class); 56 try 57 { 58 WindowURL navURL = other.navURL; 59 if (mode != null) 60 { 61 navURL.setMode(Mode.create(mode)); 62 } 63 else 64 { 65 navURL.setMode(null); 66 } 67 if (windowState != null) 68 { 69 navURL.setWindowState(WindowState.create(windowState)); 70 } 71 else 72 { 73 navURL.setWindowState(null); 74 } 75 JspWriter writer = pageContext.getOut(); 76 String url = other.resp.createURL(navURL, true); 77 writer.print(url); 78 return SKIP_BODY; 79 } 80 catch (IOException e) 81 { 82 throw new JspTagException (e); 83 } 84 } 85 86 public int doEndTag() throws JspException 87 { 88 return EVAL_PAGE; 89 } 90 } 91 | Popular Tags |