/*
* $Id: TestBean.java 54929 2004-10-16 16:38:42Z germuska $
*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.struts.webapp.exercise;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.LabelValueBean;
/**
* General purpose test bean for Struts custom tag tests.
*
* @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
*/
public class TestBean extends ActionForm {
// ------------------------------------------------------------- Properties
/**
* A collection property where the elements of the collection are
* of type <code>LabelValueBean</code>.
*/
private Collection beanCollection = null;
public Collection getBeanCollection() {
if (beanCollection == null) {
Vector entries = new Vector(10);
entries.add(new LabelValueBean("Label 0", "Value 0"));
entries.add(new LabelValueBean("Label 1", "Value 1"));
entries.add(new LabelValueBean("Label 2", "Value 2"));
entries.add(new LabelValueBean("Label 3", "Value 3"));
entries.add(new LabelValueBean("Label 4", "Value 4"));
entries.add(new LabelValueBean("Label 5", "Value 5"));
entries.add(new LabelValueBean("Label 6", "Value 6"));
entries.add(new LabelValueBean("Label 7", "Value 7"));
entries.add(new LabelValueBean("Label 8", "Value 8"));
entries.add(new LabelValueBean("Label 9", "Value 9"));
beanCollection = entries;
}
return (beanCollection);
}
public void setBeanCollection(Collection beanCollection) {
this.beanCollection = beanCollection;
}
/**
* A multiple-String SELECT element using a bean collection.
*/
private String[] beanCollectionSelect = { "Value 1", "Value 3",
"Value 5" };
public String[] getBeanCollectionSelect() {
return (this.beanCollectionSelect);
}
public void setBeanCollectionSelect(String beanCollectionSelect[]) {
this.beanCollectionSelect = beanCollectionSelect;
}
/**
* A boolean property whose initial value is true.
*/
private boolean booleanProperty = true;
public boolean getBooleanProperty() {
return (booleanProperty);
}
public void setBooleanProperty(boolean booleanProperty) {
this.booleanProperty = booleanProperty;
}
/**
* 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;
public double getDoubleProperty() {
return (this.doubleProperty);
}
public void setDoubleProperty(double doubleProperty) {
this.doubleProperty = doubleProperty;
}
/**
* A boolean property whose initial value is false
*/
private boolean falseProperty = false;
public boolean getFalseProperty() {
return (falseProperty);
}
public void setFalseProperty(boolean falseProperty) {
this.falseProperty = falseProperty;
}
/**
* A float property.
*/
private float floatProperty = (float) 123.0;
public float getFloatProperty() {
return (this.floatProperty);
}
public void setFloatProperty(float floatProperty) {
this.floatProperty = floatProperty;
}
/**
* Integer arrays that are accessed as an array as well as indexed.
*/
private int intArray[] = { 0, 10, 20, 30, 40 };
public int[] getIntArray() {
return (this.intArray);
}
public void setIntArray(int intArray[]) {
this.intArray = intArray;
}
private int intIndexed[] = { 0, 10, 20, 30, 40 };
public int getIntIndexed(int index) {
return (intIndexed[index]);
}
public void setIntIndexed(int index, int value) {
intIndexed[index] = value;
}
private int intMultibox[] = new int[0];
public int[] getIntMultibox() {
return (this.intMultibox);
}
public void setIntMultibox(int intMultibox[]) {
this.intMultibox = intMultibox;
}
/**
* An integer property.
*/
private int intProperty = 123;
public int getIntProperty() {
return (this.intProperty);
}
public void setIntProperty(int intProperty) {
this.intProperty = intProperty;
}
/**
* A long property.
*/
private long longProperty = 321;
public long getLongProperty() {
return (this.longProperty);
}
public void setLongProperty(long longProperty) {
this.longProperty = longProperty;
}
/**
* A multiple-String SELECT element.
*/
private String[] multipleSelect = { "Multiple 3", "Multiple 5",
"Multiple 7" };
public String[] getMultipleSelect() {
return (this.multipleSelect);
}
public void setMultipleSelect(String multipleSelect[]) {
this.multipleSelect = multipleSelect;
}
/**
* A nested reference to another test bean (populated as needed).
*/
private TestBean nested = null;
public TestBean getNested() {
if (nested == null)
nested = new TestBean();
return (nested);
}
/**
* A String property with an initial value of null.
*/
private String nullProperty = null;
public String getNullProperty() {
return (this.nullProperty);
}
public void setNullProperty(String nullProperty) {
this.nullProperty = nullProperty;
}
/**
* A short property.
*/
private short shortProperty = (short) 987;
public short getShortProperty() {
return (this.shortProperty);
}
public void setShortProperty(short shortProperty) {
this.shortProperty = shortProperty;
}
/**
* A single-String value for a SELECT element.
*/
private String singleSelect = "Single 5";
public String getSingleSelect() {
return (this.singleSelect);
}
public void setSingleSelect(String singleSelect) {
this.singleSelect = singleSelect;
}
/**
* String arrays that are accessed as an array as well as indexed.
*/
private String stringArray[] =
{ "String 0", "String 1", "String 2", "String 3", "String 4" };
public String[] getStringArray() {
return (this.stringArray);
}
public void setStringArray(String stringArray[]) {
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
struts标签相关的一个java工程 (181个子文件)
TestBean.class 9KB
TypeForm.class 5KB
UploadAction.class 4KB
MultiRegistrationAction.class 3KB
EditTypeAction.class 3KB
LocaleAction.class 3KB
UploadForm.class 3KB
RegistrationAction.class 3KB
TypeAction.class 2KB
RegistrationForm.class 2KB
ImageAction.class 2KB
HtmlSettersAction.class 1KB
CityStateZip.class 1KB
SuccessAction.class 1KB
CustomActionForward.class 651B
CustomActionMapping.class 651B
CustomActionForm.class 639B
CustomFormBean.class 637B
.classpath 949B
struts-config_1_1.dtd 35KB
struts-config_1_2.dtd 34KB
web-app_2_3.dtd 33KB
struts-config_1_0.dtd 18KB
web-app_2_2.dtd 16KB
tiles-config_1_1.dtd 12KB
struts-power.gif 2KB
struts-power.gif 2KB
index.html 3KB
index.html 389B
struts.jar 531KB
struts.jar 531KB
antlr.jar 350KB
antlr.jar 350KB
commons-beanutils.jar 184KB
commons-beanutils.jar 184KB
commons-digester.jar 164KB
commons-digester.jar 164KB
commons-validator.jar 82KB
commons-validator.jar 82KB
jakarta-oro.jar 64KB
jakarta-oro.jar 64KB
commons-logging.jar 37KB
commons-logging.jar 37KB
commons-fileupload.jar 22KB
commons-fileupload.jar 22KB
TestBean.java 12KB
TestBean.java 12KB
TypeForm.java 6KB
TypeForm.java 6KB
UploadAction.java 6KB
UploadAction.java 6KB
UploadForm.java 5KB
UploadForm.java 5KB
MultiRegistrationAction.java 4KB
MultiRegistrationAction.java 4KB
EditTypeAction.java 4KB
EditTypeAction.java 4KB
LocaleAction.java 4KB
LocaleAction.java 4KB
RegistrationAction.java 4KB
RegistrationAction.java 4KB
TypeAction.java 4KB
TypeAction.java 4KB
RegistrationForm.java 3KB
RegistrationForm.java 3KB
HtmlSettersAction.java 2KB
HtmlSettersAction.java 2KB
ImageAction.java 2KB
ImageAction.java 2KB
SuccessAction.java 2KB
SuccessAction.java 2KB
CustomFormBean.java 2KB
CustomFormBean.java 2KB
CustomActionForward.java 2KB
CustomActionMapping.java 2KB
CustomActionMapping.java 2KB
CustomActionForward.java 2KB
CustomActionForm.java 2KB
CustomActionForm.java 2KB
CityStateZip.java 2KB
CityStateZip.java 2KB
logic-compare-numeric.jsp 15KB
bean-write.jsp 8KB
logic-match.jsp 8KB
html-link.jsp 7KB
logic-compare.jsp 6KB
jsType.jsp 6KB
validWhenExamples.jsp 6KB
html-select.jsp 6KB
html-messages.jsp 6KB
type.jsp 6KB
bean-define.jsp 5KB
html-multibox.jsp 5KB
html-setters.jsp 5KB
bean-cookie.jsp 4KB
logic-iterate.jsp 4KB
bean-write-2.jsp 4KB
bundleExamples.jsp 3KB
index.jsp 3KB
logic-empty.jsp 3KB
共 181 条
- 1
- 2
everygo
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0