1 18 package org.apache.struts.taglib.nested; 19 20 import javax.servlet.http.HttpServletRequest ; 21 import javax.servlet.jsp.JspException ; 22 import javax.servlet.jsp.tagext.BodyTagSupport ; 23 24 import org.apache.struts.taglib.TagUtils; 25 26 35 public class NestedWriteNestingTag extends BodyTagSupport { 36 37 40 public String getProperty() { 41 return this.property; 42 } 43 44 47 public void setProperty(String newProperty) { 48 this.property = newProperty; 49 } 50 51 52 55 public String getId() { 56 return id; 57 } 58 59 62 public void setId(String id) { 63 this.id = id; 64 } 65 66 67 70 public boolean getFilter() { 71 return this.filter; 72 } 73 74 77 public void setFilter(boolean newFilter) { 78 this.filter = newFilter; 79 } 80 81 82 88 public int doStartTag() throws JspException { 89 originalProperty = property; 91 92 HttpServletRequest request = (HttpServletRequest )pageContext.getRequest(); 93 String nesting = NestedPropertyHelper.getAdjustedProperty(request, property); 94 95 if (id != null) { 96 pageContext.setAttribute(id, nesting); 98 99 } else { 100 101 if (this.filter) { 102 TagUtils.getInstance().write(pageContext, TagUtils.getInstance().filter(nesting)); 103 } else { 104 TagUtils.getInstance().write(pageContext, nesting); 105 } 106 } 107 108 109 return (SKIP_BODY); 110 } 111 112 public int doEndTag() throws JspException { 113 int i = super.doEndTag(); 115 property = originalProperty; 117 return i; 119 } 120 121 122 125 public void release() { 126 super.release(); 127 this.filter = false; 128 this.property = null; 129 this.originalProperty = null; 130 } 131 132 133 private boolean filter = false; 134 private String property = null; 135 private String id = null; 136 private String originalProperty = null; 137 } 138 | Popular Tags |