martinc 01/10/14 22:56:22
Modified: src/exercise-taglib/org/apache/struts/webapp/exercise Tag:
STRUTS_1_0_BRANCH TestBean.java
web/exercise-taglib Tag: STRUTS_1_0_BRANCH html-select.jsp
Added: src/exercise-taglib/org/apache/struts/webapp/exercise Tag:
STRUTS_1_0_BRANCH OptionBean.java
Log:
Added test case for <html:select> using <html:options> based on a collection
saved in the page context.
Revision Changes Path
No revision
No revision
1.2.2.1 +20 -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.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- TestBean.java 2001/05/04 21:49:27 1.2
+++ TestBean.java 2001/10/15 05:56:22 1.2.2.1
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java,v
1.2 2001/05/04 21:49:27 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2001/05/04 21:49:27 $
+ * $Header:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java,v
1.2.2.1 2001/10/15 05:56:22 martinc Exp $
+ * $Revision: 1.2.2.1 $
+ * $Date: 2001/10/15 05:56:22 $
*
* ====================================================================
*
@@ -72,7 +72,7 @@
* General purpose test bean for Struts custom tag tests.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2001/05/04 21:49:27 $
+ * @version $Revision: 1.2.2.1 $ $Date: 2001/10/15 05:56:22 $
*/
public class TestBean extends ActionForm {
@@ -96,6 +96,21 @@
/**
+ * A multiple-String SELECT element using a collection.
+ */
+ private String[] collectionSelect = { "Value 2", "Value 4",
+ "Value 6" };
+
+ public String[] getCollectionSelect() {
+ return (this.collectionSelect);
+ }
+
+ public void setCollectionSelect(String collectionSelect[]) {
+ this.collectionSelect = collectionSelect;
+ }
+
+
+ /**
* A double property.
*/
private double doubleProperty = 321.0;
@@ -327,6 +342,7 @@
public void reset(ActionMapping mapping, HttpServletRequest request) {
booleanProperty = false;
+ collectionSelect = new String[0];
intMultibox = new int[0];
multipleSelect = new String[0];
stringMultibox = new String[0];
No revision
No revision
1.1.2.1 +0 -0
jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/OptionBean.java
Index: OptionBean.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/OptionBean.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- OptionBean.java 2001/10/15 05:50:10 1.1
+++ OptionBean.java 2001/10/15 05:56:22 1.1.2.1
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/OptionBean.java,v
1.1 2001/10/15 05:50:10 martinc Exp $
- * $Revision: 1.1 $
- * $Date: 2001/10/15 05:50:10 $
+ * $Header:
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/OptionBean.java,v
1.1.2.1 2001/10/15 05:56:22 martinc Exp $
+ * $Revision: 1.1.2.1 $
+ * $Date: 2001/10/15 05:56:22 $
*
* ====================================================================
*
@@ -68,7 +68,7 @@
* in conjunction with the <code>collection</code> attribute.
*
* @author Martin F N Cooper
- * @version $Revision: 1.1 $ $Date: 2001/10/15 05:50:10 $
+ * @version $Revision: 1.1.2.1 $ $Date: 2001/10/15 05:56:22 $
*/
public class OptionBean {
No revision
No revision
1.1.2.1 +23 -1 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.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- html-select.jsp 2001/03/07 04:50:54 1.1
+++ html-select.jsp 2001/10/15 05:56:22 1.1.2.1
@@ -1,4 +1,4 @@
-<%@ page language="java"%>
+<%@ page language="java" import="java.util.*,
org.apache.struts.webapp.exercise.*;"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
@@ -10,6 +10,19 @@
{ "Multiple 0", "Multiple 1", "Multiple 2", "Multiple 3", "Multiple 4",
"Multiple 5", "Multiple 6", "Multiple 7", "Multiple 8", "Multiple 9" };
pageContext.setAttribute("multipleValues", multipleValues);
+
+ Vector options = new Vector();
+ options.add(new OptionBean("Label 0", "Value 0"));
+ options.add(new OptionBean("Label 1", "Value 1"));
+ options.add(new OptionBean("Label 2", "Value 2"));
+ options.add(new OptionBean("Label 3", "Value 3"));
+ options.add(new OptionBean("Label 4", "Value 4"));
+ options.add(new OptionBean("Label 5", "Value 5"));
+ options.add(new OptionBean("Label 6", "Value 6"));
+ options.add(new OptionBean("Label 7", "Value 7"));
+ options.add(new OptionBean("Label 8", "Value 8"));
+ options.add(new OptionBean("Label 9", "Value 9"));
+ pageContext.setAttribute("options", options);
%>
</head>
<body bgcolor="white">
@@ -48,6 +61,15 @@
<td align="left">
<html:select property="multipleSelect" size="10" multiple="true">
<html:options name="multipleValues" labelName="multipleValues"/>
+ </html:select>
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">Multiple Select From A Collection:</th>
+ <td align="left">
+ <html:select property="collectionSelect" size="10" multiple="true">
+ <html:options collection="options" property="value" labelProperty="label"/>
</html:select>
</td>
</tr>