001: /*
002: * Copyright 2005-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005: * in compliance with the License. You may obtain a copy of the License at
006: *
007: * http://www.apache.org/licenses/LICENSE-2.0
008: *
009: * Unless required by applicable law or agreed to in writing, software distributed under the License
010: * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011: * or implied. See the License for the specific language governing permissions and limitations under
012: * the License.
013: */
014:
015: package org.strecks.form.impl;
016:
017: import java.util.Date;
018:
019: import org.apache.struts.action.ActionForm;
020: import org.strecks.bind.annotation.BindSimple;
021: import org.strecks.validator.annotation.ValidateInteger;
022: import org.strecks.validator.annotation.ValidateRequired;
023:
024: /**
025: * @author Phil Zoio
026: */
027: public class SimpleStrutsForm extends ActionForm {
028:
029: private static final long serialVersionUID = 1L;
030:
031: private String validField = "two";
032:
033: private Date targetDateValue;
034:
035: private Long targetLongValue;
036:
037: private NestedBean nestedBean;
038:
039: private String integerValue;
040:
041: private String longValue;
042:
043: private String dateValue;
044:
045: private Integer requiredInteger;
046:
047: public NestedBean getNestedBean() {
048: return nestedBean;
049: }
050:
051: public void setNestedBean(NestedBean nestedBean) {
052: this .nestedBean = nestedBean;
053: }
054:
055: public String getValidField() {
056: return validField;
057: }
058:
059: public Integer getRequiredInteger() {
060: return requiredInteger;
061: }
062:
063: @ValidateRequired(key="is.required")
064: public void setRequiredInteger(Integer requiredInteger) {
065: this .requiredInteger = requiredInteger;
066: }
067:
068: @ValidateRequired(key="is.required")
069: @ValidateInteger(key="is.integer")
070: public void setValidField(String validField) {
071: this .validField = validField;
072: }
073:
074: public Date getTargetDateValue() {
075: return targetDateValue;
076: }
077:
078: public void setTargetDateValue(Date targetDate) {
079: this .targetDateValue = targetDate;
080: }
081:
082: public Long getTargetLongValue() {
083: return targetLongValue;
084: }
085:
086: public void setTargetLongValue(Long targetLongValue) {
087: this .targetLongValue = targetLongValue;
088: }
089:
090: public void setDateValue(String dateValue) {
091: this .dateValue = dateValue;
092: }
093:
094: public void setIntegerValue(String integerValue) {
095: this .integerValue = integerValue;
096: }
097:
098: public void setLongValue(String longValue) {
099: this .longValue = longValue;
100: }
101:
102: @BindSimple(expression="nestedBean.targetIntegerValue")
103: public String getIntegerValue() {
104: return integerValue;
105: }
106:
107: // @Bind(expression="targetDateValue")
108: public String getDateValue() {
109: return dateValue;
110: }
111:
112: @BindSimple(expression="targetLongValue")
113: public String getLongValue() {
114: return longValue;
115: }
116:
117: }
|