morgand 01/03/06 17:54:20
Modified: scopes/src/org/apache/taglibs/scopes AttributeTag.java
BaseScopedBodyTag.java BaseScopedTag.java
Log:
new provisional taglib "scopes"
Revision Changes Path
1.2 +34 -30
jakarta-taglibs/scopes/src/org/apache/taglibs/scopes/AttributeTag.java
Index: AttributeTag.java
===================================================================
RCS file:
/home/cvs/jakarta-taglibs/scopes/src/org/apache/taglibs/scopes/AttributeTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AttributeTag.java 2001/03/06 23:07:57 1.1
+++ AttributeTag.java 2001/03/07 01:54:16 1.2
@@ -83,40 +83,44 @@
* @author Morgan Delagrange
*/
-public class AttributeTag extends BaseScopedTag
-{
- // Name of application attribute
- private String _name = null;
+public class AttributeTag extends BaseScopedTag {
+ // Name of application attribute
+ private String _name = null;
- /**
- * Method called at end of Tag to output attribute value
- *
- * @return EVAL_PAGE
- */
- public final int doEndTag() throws JspException
- {
- Object value =
- pageContext.getAttribute(_name,_scope);
- if( value == null )
- value = "";
+ /**
+ * Method called at end of Tag to output attribute value
+ *
+ * @return EVAL_PAGE
+ */
+ public final int doEndTag() throws JspException
+ {
+ Object value = null;
- try {
- pageContext.getOut().write(value.toString());
- } catch(Exception e) {
- throw new JspException("IO Error: " + e.getMessage());
- }
-
- return EVAL_PAGE;
+ if (_scopeSet == false) {
+ pageContext.findAttribute(_name);
+ } else {
+ pageContext.getAttribute(_name,_scope);
}
+ if ( value == null )
+ value = "";
- /**
- * Set the required tag attribute <b>_name</b>.
- *
- * @param String _name of application attribute
- */
- public final void setName(String str)
- {
- _name = str;
+ try {
+ pageContext.getOut().write(value.toString());
+ } catch (Exception e) {
+ throw new JspException("IO Error: " + e.getMessage());
}
+
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Set the required tag attribute <b>_name</b>.
+ *
+ * @param String _name of application attribute
+ */
+ public final void setName(String str)
+ {
+ _name = str;
+ }
}
1.2 +3 -0
jakarta-taglibs/scopes/src/org/apache/taglibs/scopes/BaseScopedBodyTag.java
Index: BaseScopedBodyTag.java
===================================================================
RCS file:
/home/cvs/jakarta-taglibs/scopes/src/org/apache/taglibs/scopes/BaseScopedBodyTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseScopedBodyTag.java 2001/03/06 23:07:57 1.1
+++ BaseScopedBodyTag.java 2001/03/07 01:54:17 1.2
@@ -64,6 +64,7 @@
public class BaseScopedBodyTag extends BodyTagSupport {
protected int _scope = PageContext.PAGE_SCOPE;
+ protected boolean _scopeSet = false;
public void setScope(String scopeName) {
if (scopeName.equals("request")) {
@@ -73,5 +74,7 @@
} else if (scopeName.equals("application")) {
_scope = PageContext.APPLICATION_SCOPE;
}
+
+ _scopeSet = true;
}
}
1.2 +3 -0
jakarta-taglibs/scopes/src/org/apache/taglibs/scopes/BaseScopedTag.java
Index: BaseScopedTag.java
===================================================================
RCS file:
/home/cvs/jakarta-taglibs/scopes/src/org/apache/taglibs/scopes/BaseScopedTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseScopedTag.java 2001/03/06 23:07:57 1.1
+++ BaseScopedTag.java 2001/03/07 01:54:17 1.2
@@ -65,6 +65,7 @@
public class BaseScopedTag extends TagSupport {
protected int _scope = PageContext.PAGE_SCOPE;
+ protected boolean _scopeSet = false;
public void setScope(String scopeName) {
if (scopeName.equals("request")) {
@@ -74,5 +75,7 @@
} else if (scopeName.equals("application")) {
_scope = PageContext.APPLICATION_SCOPE;
}
+
+ _scopeSet = true;
}
}