craigmcc 02/03/11 22:30:56
Modified: src/example/org/apache/struts/webapp/example
ApplicationResources.properties
src/exercise-taglib/org/apache/struts/webapp/exercise
TestBean.java
src/share/org/apache/struts/util LabelValueBean.java
web/example/WEB-INF struts-config.xml
web/exercise-taglib html-select.jsp
Log:
Add a test case to the struts-exercise-taglib webapp for <html:options> with
null labels and values.
Make LabelValueBean serializable so that it doesn't cause problems when the
exercise webapp is saved and reloaded on a container that tries to save and
restore session attributes (like Tomcat 4).
Correct the Struts example webapp to conform to the new rule that the
<exception> element must include a "key" attribute.
Revision Changes Path
1.4 +1 -0
jakarta-struts/src/example/org/apache/struts/webapp/example/ApplicationResources.properties
Index: ApplicationResources.properties
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/ApplicationResources.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ApplicationResources.properties 31 Dec 2001 01:14:36 -0000 1.3
+++ ApplicationResources.properties 12 Mar 2002 06:30:56 -0000 1.4
@@ -25,6 +25,7 @@
errors.footer=</ul><hr>
errors.header=<h3><font color="red">Validation Error</font></h3>You must correct
the following error(s) before proceeding:<ul>
errors.ioException=I/O exception rendering error messages: {0}
+expired.password=User Password has expired
heading.autoConnect=Auto
heading.subscriptions=Current Subscriptions
heading.host=Host Name
1.6 +18 -4
jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java
Index: TestBean.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestBean.java 23 Feb 2002 07:10:30 -0000 1.5
+++ TestBean.java 12 Mar 2002 06:30:56 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java,v
1.5 2002/02/23 07:10:30 martinc Exp $
- * $Revision: 1.5 $
- * $Date: 2002/02/23 07:10:30 $
+ * $Header:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java,v
1.6 2002/03/12 06:30:56 craigmcc Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/03/12 06:30:56 $
*
* ====================================================================
*
@@ -76,7 +76,7 @@
*
* @author Craig R. McClanahan
* @author Martin F N Cooper
- * @version $Revision: 1.5 $ $Date: 2002/02/23 07:10:30 $
+ * @version $Revision: 1.6 $ $Date: 2002/03/12 06:30:56 $
*/
public class TestBean extends ActionForm {
@@ -394,6 +394,20 @@
public void setEmptyStringProperty(String emptyStringProperty) {
this.emptyStringProperty = emptyStringProperty;
+ }
+
+
+ /**
+ * A property that allows a null value but is still used in a SELECT.
+ */
+ private String withNulls = null;
+
+ public String getWithNulls() {
+ return (this.withNulls);
+ }
+
+ public void setWithNulls(String withNulls) {
+ this.withNulls = withNulls;
}
1.2 +8 -5
jakarta-struts/src/share/org/apache/struts/util/LabelValueBean.java
Index: LabelValueBean.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/LabelValueBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LabelValueBean.java 8 Nov 2001 03:34:39 -0000 1.1
+++ LabelValueBean.java 12 Mar 2002 06:30:56 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/LabelValueBean.java,v 1.1
2001/11/08 03:34:39 martinc Exp $
- * $Revision: 1.1 $
- * $Date: 2001/11/08 03:34:39 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/LabelValueBean.java,v 1.2
2002/03/12 06:30:56 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/03/12 06:30:56 $
*
* ====================================================================
*
@@ -63,6 +63,9 @@
package org.apache.struts.util;
+import java.io.Serializable;
+
+
/**
* A simple JavaBean to represent label-value pairs. This is most commonly used
* when constructing user interface elements which have a label to be displayed
@@ -71,10 +74,10 @@
*
* @author Craig R. McClanahan
* @author Martin F N Cooper
- * @version $Revision: 1.1 $ $Date: 2001/11/08 03:34:39 $
+ * @version $Revision: 1.2 $ $Date: 2002/03/12 06:30:56 $
*/
-public class LabelValueBean {
+public class LabelValueBean implements Serializable {
// ----------------------------------------------------------- Constructors
1.19 +1 -0 jakarta-struts/web/example/WEB-INF/struts-config.xml
Index: struts-config.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/struts-config.xml,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- struts-config.xml 5 Mar 2002 04:23:57 -0000 1.18
+++ struts-config.xml 12 Mar 2002 06:30:56 -0000 1.19
@@ -112,6 +112,7 @@
scope="request"
input="/logon.jsp">
<exception
+ key="expired.password"
type="org.apache.struts.webapp.example.ExpiredPasswordException"
path="/changePassword.jsp"/>
</action>
1.7 +16 -0 jakarta-struts/web/exercise-taglib/html-select.jsp
Index: html-select.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/web/exercise-taglib/html-select.jsp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- html-select.jsp 23 Feb 2002 07:10:30 -0000 1.6
+++ html-select.jsp 12 Mar 2002 06:30:56 -0000 1.7
@@ -23,6 +23,11 @@
options.add(new LabelValueBean("Label 8", "Value 8"));
options.add(new LabelValueBean("Label 9", "Value 9"));
pageContext.setAttribute("options", options);
+
+ String withNulls[] =
+ { "String 0", null, "String 2" };
+ pageContext.setAttribute("withNulls", withNulls);
+
%>
</head>
<body bgcolor="white">
@@ -92,6 +97,17 @@
<td align="left">
<html:select property="beanCollectionSelect" size="10" multiple="true">
<html:optionsCollection name="testbean" property="beanCollection"/>
+ </html:select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">
+ Collection with null labels and values:
+ </th>
+ <td align="left">
+ <html:select property="withNulls" size="3">
+ <html:options name="withNulls" labelName="withNulls"/>
</html:select>
</td>
</tr>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>