You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by sh...@apache.org on 2002/04/18 03:57:49 UTC
cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/core OutTag.java SetTag.java
shawn 02/04/17 18:57:49
Modified: standard/src/org/apache/taglibs/standard/tag/common/core
OutSupport.java SetSupport.java
standard/src/org/apache/taglibs/standard/tag/el/core
OutTag.java SetTag.java
standard/src/org/apache/taglibs/standard/tag/rt/core
OutTag.java SetTag.java
Log:
General errors in new <c:out> and <c:set>... jeez. :-)
Revision Changes Path
1.3 +3 -3 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/core/OutSupport.java
Index: OutSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/core/OutSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OutSupport.java 18 Apr 2002 01:15:11 -0000 1.2
+++ OutSupport.java 18 Apr 2002 01:57:48 -0000 1.3
@@ -84,7 +84,7 @@
//*********************************************************************
// Internal state
- protected String value ; // tag attribute
+ protected Object value; // tag attribute
protected String def; // tag attribute
protected boolean escapeXml; // tag attribute
private boolean needBody; // non-space body needed?
@@ -138,9 +138,9 @@
}
// if we do have 'default', try it
- if (result != null) {
+ if (def != null) {
// good 'default'
- out(pageContext, escapeXml, result.toString());
+ out(pageContext, escapeXml, def.toString());
return SKIP_BODY;
} else {
// bad 'default'
1.3 +9 -15 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/core/SetSupport.java
Index: SetSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/core/SetSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SetSupport.java 18 Apr 2002 01:22:22 -0000 1.2
+++ SetSupport.java 18 Apr 2002 01:57:48 -0000 1.3
@@ -65,9 +65,7 @@
import org.apache.taglibs.standard.resources.Resources;
/**
- * <p>A handler for the <set> tag, which evaluates an expression
- * -- or its body -- and stores the resulting value in the 'scoped'
- * attribute specified by the 'var' and 'scope' attributes.</p>
+ * <p>Support for handlers of the <set> tag.</p>
*
* @author Shawn Bayern
*/
@@ -76,7 +74,7 @@
//*********************************************************************
// Internal state
- protected String value; // tag attribute
+ protected Object value; // tag attribute
protected Object target; // tag attribute
protected String property; // tag attribute
private String var; // tag attribute
@@ -111,21 +109,14 @@
//*********************************************************************
// Tag logic
- // evaluates the expression and stores it appropriately
public int doEndTag() throws JspException {
Object result; // what we'll store in scope:var
// determine the value by...
if (value != null) {
- // ... evaluating our expression
- result = ExpressionEvaluatorManager.evaluate(
- "value", value, Object.class, this, pageContext);
- if (result == null) {
- // throw new NullAttributeException("set", "value");
- pageContext.removeAttribute(var, scope);
- return EVAL_PAGE;
- }
+ // ... reading our attribute
+ result = value;
} else {
// ... retrieving and trimming our body
if (bodyContent == null || bodyContent.getString() == null)
@@ -143,14 +134,17 @@
* is made to store something in the session without any
* HttpSession existing).
*/
- pageContext.setAttribute(var, result, scope);
+ if (result != null)
+ pageContext.setAttribute(var, result, scope);
+ else
+ pageContext.removeAttribute(var);
} else if (target != null) {
// save the result to target.property
if (target instanceof Map) {
// ... treating it as a Map entry
- if (property == null)
+ if (result == null)
((Map) target).remove(property);
else
((Map) target).put(property, result);
1.3 +8 -10 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core/OutTag.java
Index: OutTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core/OutTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OutTag.java 18 Apr 2002 01:10:53 -0000 1.2
+++ OutTag.java 18 Apr 2002 01:57:49 -0000 1.3
@@ -133,16 +133,14 @@
/* Evaluates expressions as necessary */
private void evaluateExpressions() throws JspException {
- /*
- * Note: we don't check for type mismatches here; we assume
- * the expression evaluator will return the expected type
- * (by virtue of knowledge we give it about what that type is).
- * A ClassCastException here is truly unexpected, so we let it
- * propagate up.
- */
-
- value = (String) ExpressionUtil.evalNotNull(
- "out", "value", value_, String.class, this, pageContext);
+ value = null;
+ try {
+ value = ExpressionUtil.evalNotNull(
+ "out", "value", value_, Object.class, this, pageContext);
+ } catch (Exception ex) {
+ // explicitly allow 'null' for value and mask other errors per spec
+ value = null;
+ }
def = (String) ExpressionUtil.evalNotNull(
"out", "default", default_, String.class, this, pageContext);
escapeXml = true;
1.6 +12 -2 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core/SetTag.java
Index: SetTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core/SetTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SetTag.java 17 Apr 2002 21:02:55 -0000 1.5
+++ SetTag.java 18 Apr 2002 01:57:49 -0000 1.6
@@ -141,10 +141,20 @@
* propagate up.
*/
- value = (String) ExpressionUtil.evalNotNull(
- "set", "value", value_, String.class, this, pageContext);
+ // 'value'
+ try {
+ value = ExpressionUtil.evalNotNull(
+ "set", "value", value_, Object.class, this, pageContext);
+ } catch (NullAttributeException ex) {
+ // explicitly let 'value' be null
+ value = null;
+ }
+
+ // 'target'
target = ExpressionUtil.evalNotNull(
"set", "target", target_, Object.class, this, pageContext);
+
+ // 'property'
try {
property = (String) ExpressionUtil.evalNotNull(
"set", "property", property_, String.class, this, pageContext);
1.2 +1 -1 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/core/OutTag.java
Index: OutTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/core/OutTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- OutTag.java 17 Apr 2002 21:02:55 -0000 1.1
+++ OutTag.java 18 Apr 2002 01:57:49 -0000 1.2
@@ -71,7 +71,7 @@
// Accessors
// for tag attribute
- public void setValue(String value) {
+ public void setValue(Object value) {
this.value = value;
}
1.2 +1 -1 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/core/SetTag.java
Index: SetTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/core/SetTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SetTag.java 17 Apr 2002 14:54:12 -0000 1.1
+++ SetTag.java 18 Apr 2002 01:57:49 -0000 1.2
@@ -71,7 +71,7 @@
// Accessors
// for tag attribute
- public void setValue(String value) {
+ public void setValue(Object value) {
this.value = value;
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>