dgeary 01/02/26 08:44:18
Modified: src/share/org/apache/struts/taglib/template GetTag.java
InsertTag.java PutTag.java
Log:
Added getter methods for tag attributes
Revision Changes Path
1.7 +23 -5 jakarta-struts/src/share/org/apache/struts/taglib/template/GetTag.java
Index: GetTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/GetTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- GetTag.java 2001/01/22 19:45:57 1.6
+++ GetTag.java 2001/02/26 16:44:16 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/GetTag.java,v
1.6 2001/01/22 19:45:57 dgeary Exp $
- * $Revision: 1.6 $
- * $Date: 2001/01/22 19:45:57 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/GetTag.java,v
1.7 2001/02/26 16:44:16 dgeary Exp $
+ * $Revision: 1.7 $
+ * $Date: 2001/02/26 16:44:16 $
*
* ====================================================================
*
@@ -75,7 +75,7 @@
* it, depending upon the value of the content's direct attribute.
*
* @author David Geary
- * @version $Revision: 1.6 $ $Date: 2001/01/22 19:45:57 $
+ * @version $Revision: 1.7 $ $Date: 2001/02/26 16:44:16 $
*/
public class GetTag extends TagSupport {
@@ -112,6 +112,24 @@
}
+ /**
+ * Get the name attribute.
+ */
+ public String getName() {
+
+ return name;
+
+ }
+
+ /**
+ * Get the role attribute.
+ */
+ public String getRole() {
+
+ return role;
+
+ }
+
// --------------------------------------------------------- Public Methods
/**
@@ -125,7 +143,7 @@
if(role != null && !request.isUserInRole(role))
return SKIP_BODY;
- ContentMap map = ContentMapStack.peek(pageContext);
+ ContentMap map = ContentMapStack.peek(pageContext);
Content content = map.get(name);
if(content != null) {
1.6 +23 -5 jakarta-struts/src/share/org/apache/struts/taglib/template/InsertTag.java
Index: InsertTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/InsertTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- InsertTag.java 2001/02/23 17:15:00 1.5
+++ InsertTag.java 2001/02/26 16:44:16 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/InsertTag.java,v
1.5 2001/02/23 17:15:00 dgeary Exp $
- * $Revision: 1.5 $
- * $Date: 2001/02/23 17:15:00 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/InsertTag.java,v
1.6 2001/02/26 16:44:16 dgeary Exp $
+ * $Revision: 1.6 $
+ * $Date: 2001/02/26 16:44:16 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* tags, which are accessed by <template:get> in the template.
*
* @author David Geary
- * @version $Revision: 1.5 $ $Date: 2001/02/23 17:15:00 $
+ * @version $Revision: 1.6 $ $Date: 2001/02/26 16:44:16 $
*/
public class InsertTag extends TagSupport {
@@ -97,11 +97,29 @@
/**
- * Setter for the template attribute.
+ * Set the template attribute.
*/
public void setTemplate(String template) {
this.template = template;
+
+ }
+
+ /**
+ * Get the template attribute.
+ */
+ public String getTemplate() {
+
+ return template;
+
+ }
+
+ /**
+ * Get the map attribute.
+ */
+ public ContentMap getContentMap() {
+
+ return map;
}
1.8 +40 -15 jakarta-struts/src/share/org/apache/struts/taglib/template/PutTag.java
Index: PutTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/PutTag.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PutTag.java 2001/01/22 19:45:59 1.7
+++ PutTag.java 2001/02/26 16:44:16 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/PutTag.java,v
1.7 2001/01/22 19:45:59 dgeary Exp $
- * $Revision: 1.7 $
- * $Date: 2001/01/22 19:45:59 $
+ * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/template/PutTag.java,v
1.8 2001/02/26 16:44:16 dgeary Exp $
+ * $Revision: 1.8 $
+ * $Date: 2001/02/26 16:44:16 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* Tag handler for <template:put>, which puts content into request scope.
*
* @author David Geary
- * @version $Revision: 1.7 $ $Date: 2001/01/22 19:45:59 $
+ * @version $Revision: 1.8 $ $Date: 2001/02/26 16:44:16 $
*/
public class PutTag extends BodyTagSupport {
@@ -146,7 +146,41 @@
}
+ /**
+ * Get the name attribute.
+ */
+ public String getName() {
+
+ return name;
+
+ }
+
+ /**
+ * Get the role attribute.
+ */
+ public String getRole() {
+
+ return role;
+
+ }
+
+ /**
+ * Get the content attribute.
+ */
+ public String getContent() {
+
+ return content;
+ }
+
+ /**
+ * Returns the direct attribute associated with this tag.
+ */
+ public String getDirect() {
+ if(hasBody()) return "true";
+ else return direct == null ? "false" : "true";
+ }
+
/**
* Process the end tag by putting content into the enclosing
* insert tag.
@@ -168,7 +202,7 @@
throw new JspException("PutTag.doEndTag(): " +
"No InsertTag ancestor");
- insertTag.put(name, new Content(getContent(), getDirect()));
+ insertTag.put(name, new Content(getActualContent(), getDirect()));
return EVAL_PAGE;
@@ -190,7 +224,7 @@
/**
* Returns the content associated with this tag.
*/
- private String getContent() throws JspException {
+ private String getActualContent() throws JspException {
String bodyAndContentMismatchError =
"Please specify template content in this tag's body " +
@@ -219,15 +253,6 @@
if (bodyContent == null)
return (false);
return ! bodyContent.getString().equals("");
- }
-
-
- /**
- * Returns the direct attribute associated with this tag.
- */
- private String getDirect() {
- if(hasBody()) return "true";
- else return direct == null ? "false" : "true";
}
|