craigmcc 02/03/15 19:06:42 Modified: doc Tag: STRUTS_1_0_BRANCH struts-logic.xml src/share/org/apache/struts/taglib/logic Tag: STRUTS_1_0_BRANCH CompareTagBase.java web/exercise-taglib Tag: STRUTS_1_0_BRANCH logic-compare.jsp Log: Port enhancement to the comparison tags that coerces null variable results to a zero-length string before the comparison occurs. PR: Bugzilla #6409 Submitted by: Ovidiu Podisor <opodisor at websitepros.com> Revision Changes Path No revision No revision 1.6.2.4 +2 -2 jakarta-struts/doc/Attic/struts-logic.xml Index: struts-logic.xml =================================================================== RCS file: /home/cvs/jakarta-struts/doc/Attic/struts-logic.xml,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -u -r1.6.2.3 -r1.6.2.4 --- struts-logic.xml 6 Feb 2002 05:04:05 -0000 1.6.2.3 +++ struts-logic.xml 16 Mar 2002 03:06:42 -0000 1.6.2.4 @@ -33,8 +33,8 @@ <code>name</code>, <code>parameter</code>, <code>property</code>) present on this tag. It will be converted to the appropriate type for the comparison, as determined above.</li> - <li>A request time exception will be thrown if the specified variable - cannot be retrieved, or has a null value.</li> + <li>If the specified variable or property returns null, it will be + coerced to a zero-length string before the comparison occurs.</li> <li>The specific comparison for this tag will be performed, and the nested body content of this tag will be evaluated if the comparison returns a <code>true</code> result.</li> No revision No revision 1.6.2.1 +5 -8 jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java Index: CompareTagBase.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- CompareTagBase.java 12 Feb 2001 21:49:54 -0000 1.6 +++ CompareTagBase.java 16 Mar 2002 03:06:42 -0000 1.6.2.1 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java,v 1.6 2001/02/12 21:49:54 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2001/02/12 21:49:54 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java,v 1.6.2.1 2002/03/16 03:06:42 craigmcc Exp $ + * $Revision: 1.6.2.1 $ + * $Date: 2002/03/16 03:06:42 $ * * ==================================================================== * @@ -78,7 +78,7 @@ * define values for desired1 and desired2. * * @author Craig R. McClanahan - * @version $Revision: 1.6 $ $Date: 2001/02/12 21:49:54 $ + * @version $Revision: 1.6.2.1 $ $Date: 2002/03/16 03:06:42 $ */ public abstract class CompareTagBase extends ConditionalTagBase { @@ -253,10 +253,7 @@ throw e; } if (variable == null) { - JspException e = new JspException - (messages.getMessage("logic.variable", value)); - RequestUtils.saveException(pageContext, e); - throw e; + variable = ""; // Coerce null to a zero-length String } // Perform the appropriate comparison No revision No revision 1.4.2.1 +64 -32 jakarta-struts/web/exercise-taglib/logic-compare.jsp Index: logic-compare.jsp =================================================================== RCS file: /home/cvs/jakarta-struts/web/exercise-taglib/logic-compare.jsp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- logic-compare.jsp 4 May 2001 21:49:31 -0000 1.4 +++ logic-compare.jsp 16 Mar 2002 03:06:42 -0000 1.4.2.1 @@ -390,38 +390,6 @@ </td> </tr> <tr> - <td>string / EQ</td> - <td><bean:write name="bean" property="stringProperty"/></td> - <td><%= str1 %></td> - <td>equal greaterEqual lessEqual</td> - <td> - <logic:equal name="bean" property="stringProperty" - value="<%= str1 %>"> - equal - </logic:equal> - <logic:greaterEqual name="bean" property="stringProperty" - value="<%= str1 %>"> - greaterEqual - </logic:greaterEqual> - <logic:greaterThan name="bean" property="stringProperty" - value="<%= str1 %>"> - greaterThan - </logic:greaterThan> - <logic:lessEqual name="bean" property="stringProperty" - value="<%= str1 %>"> - lessEqual - </logic:lessEqual> - <logic:lessThan name="bean" property="stringProperty" - value="<%= str1 %>"> - lessThan - </logic:lessThan> - <logic:notEqual name="bean" property="stringProperty" - value="<%= str1 %>"> - notEqual - </logic:notEqual> - </td> - </tr> - <tr> <td>long / EQ</td> <td><bean:write name="bean" property="longProperty"/></td> <td><%= long1 %></td> @@ -614,6 +582,38 @@ </td> </tr> <tr> + <td>string / EQ</td> + <td><bean:write name="bean" property="stringProperty"/></td> + <td><%= str1 %></td> + <td>equal greaterEqual lessEqual</td> + <td> + <logic:equal name="bean" property="stringProperty" + value="<%= str1 %>"> + equal + </logic:equal> + <logic:greaterEqual name="bean" property="stringProperty" + value="<%= str1 %>"> + greaterEqual + </logic:greaterEqual> + <logic:greaterThan name="bean" property="stringProperty" + value="<%= str1 %>"> + greaterThan + </logic:greaterThan> + <logic:lessEqual name="bean" property="stringProperty" + value="<%= str1 %>"> + lessEqual + </logic:lessEqual> + <logic:lessThan name="bean" property="stringProperty" + value="<%= str1 %>"> + lessThan + </logic:lessThan> + <logic:notEqual name="bean" property="stringProperty" + value="<%= str1 %>"> + notEqual + </logic:notEqual> + </td> + </tr> + <tr> <td>string / GT</td> <td><bean:write name="bean" property="stringProperty"/></td> <td><%= str2 %></td> @@ -673,6 +673,38 @@ </logic:lessThan> <logic:notEqual name="bean" property="stringProperty" value="<%= str3 %>"> + notEqual + </logic:notEqual> + </td> + </tr> + <tr> + <td>string / NULL</td> + <td><bean:write name="bean" property="nullProperty"/> </td> + <td> </td> + <td>equal greaterEqual lessEqual</td> + <td> + <logic:equal name="bean" property="nullProperty" + value=""> + equal + </logic:equal> + <logic:greaterEqual name="bean" property="nullProperty" + value=""> + greaterEqual + </logic:greaterEqual> + <logic:greaterThan name="bean" property="nullProperty" + value=""> + greaterThan + </logic:greaterThan> + <logic:lessEqual name="bean" property="nullProperty" + value=""> + lessEqual + </logic:lessEqual> + <logic:lessThan name="bean" property="nullProperty" + value=""> + lessThan + </logic:lessThan> + <logic:notEqual name="bean" property="nullProperty" + value=""> notEqual </logic:notEqual> </td>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>