Author: rich
Date: Sat Jan 8 22:08:48 2005
New Revision: 124708
URL: http://svn.apache.org/viewcvs?view=rev&rev=124708
Log:
Miscellaneous fixes:
- Fixed to merge the string values in inherited 'rolesAllowed' and
'tilesDefinitions' attributes in @Jpf.Controller.
- Fixed to avoid disabling 'currentPage' and 'previousPage' navigation when
these values are only used in the 'validationErrorForward' attribute on
@Jpf.Action (and are not used in any other annotations).
- Removed the warning for Forward/SimpleAction/Catch annotations that refer
to nonexistant files when the class being compiled is abstract.
- Added a warning for *inherited* Forward/SimpleAction/Catch annotations
that refer to nonexistant files.
- Added a warning for @Jpf.Action and @Jpf.ExceptionHandler annotations on
abstract methods (which renders them useless, since these annotations are not
inherited).
- Fixed the default behavior for unhandled exceptions to allow
PageFlowManagedObjectExceptions (like exceptions related to JSF backing files)
to write out an informative response page in dev mode.
- Fixed to remove an error logged at startup of applications that don't
contain a Global.app file.
- In FlowController, changed getPreviousFormBean, getPreviousActionURI,
getCurrentForwardPath, getPreviousForwardPath, getCurrentPageInfo,
getPreviousPageInfo, and getPreviousActionInfo to throw IllegalStateException
when previous {page,action} info has been disabled due to unuse through
annotations, and when alwaysTrackPrevious{Page,Action} was not overridden to
return true.
- Fixed an NPE in PageFlowChecker when compiled page flow classes are on
classpath but not on sourcepath.
DRT: netui (WinXP)
BB: self (linux)
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/Controller.jpf
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/GetZip.jpf
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/confirm.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/index.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/index.jsp
(contents, props changed)
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/results.jsp
(contents, props changed)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
Sat Jan 8 22:08:48 2005
@@ -1142,4 +1142,28 @@
return baseType;
}
+
+ public static final class Mutable< T >
+ {
+ private T _val = null;
+
+ public Mutable()
+ {
+ }
+
+ public Mutable( T val )
+ {
+ _val = val;
+ }
+
+ public void set( T val )
+ {
+ _val = val;
+ }
+
+ public T get()
+ {
+ return _val;
+ }
+ }
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/FlowControllerChecker.java
Sat Jan 8 22:08:48 2005
@@ -19,6 +19,7 @@
import org.apache.beehive.netui.compiler.grammar.ActionGrammar;
import org.apache.beehive.netui.compiler.grammar.ExceptionHandlerGrammar;
+import org.apache.beehive.netui.compiler.grammar.WebappPathType;
import org.apache.beehive.netui.compiler.genmodel.GenStrutsApp;
import org.apache.beehive.netui.compiler.model.NoWebInfDirectoryException;
import org.apache.xmlbeans.XmlException;
@@ -36,10 +37,11 @@
import java.util.Map;
import java.util.HashMap;
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
+
public abstract class FlowControllerChecker
extends BaseChecker
- implements JpfLanguageConstants
{
private FlowControllerInfo _fcInfo;
private AnnotationGrammar _controllerGrammar;
@@ -48,7 +50,7 @@
private FormBeanChecker _formBeanChecker;
private Map _checkResultMap;
- public FlowControllerChecker( AnnotationProcessorEnvironment env,
Diagnostics diags, FlowControllerInfo fcInfo )
+ protected FlowControllerChecker( AnnotationProcessorEnvironment env,
Diagnostics diags, FlowControllerInfo fcInfo )
{
super( env, diags );
_fcInfo = fcInfo;
@@ -181,6 +183,10 @@
for ( MethodDeclaration method : methods )
{
AnnotationMirror ann = CompilerUtils.getAnnotation( method,
ACTION_TAG_NAME );
+ if ( ann != null )
+ {
+ enableNavigateTo( CompilerUtils.getAnnotation( ann,
VALIDATION_ERROR_FORWARD_ATTR, true ), fcInfo );
+ }
if ( ann == null ) ann = CompilerUtils.getAnnotation( method,
EXCEPTION_HANDLER_TAG_NAME );
if ( ann != null ) enableNavigateTo(
CompilerUtils.getAnnotationArray( ann, FORWARDS_ATTR, true ), fcInfo );
}
@@ -192,20 +198,26 @@
{
for ( AnnotationMirror childAnnotation : childAnnotations )
{
- String val = CompilerUtils.getEnumFieldName( childAnnotation,
NAVIGATE_TO_ATTR, true );
-
- if ( val != null )
- {
- if ( val.equals( NAVIGATE_TO_CURRENT_PAGE_STR ) ||
val.equals( NAVIGATE_TO_PREVIOUS_PAGE_STR )
- || val.equals( NAVIGATE_TO_PAGE_LEGACY_STR ) )
- {
- fcInfo.enableNavigateToPage();
- }
- else if ( val.equals( NAVIGATE_TO_PREVIOUS_ACTION_STR ) )
- {
- fcInfo.enableNavigateToAction();
- }
- }
+ enableNavigateTo( childAnnotation, fcInfo );
+ }
+ }
+ }
+
+ private static void enableNavigateTo( AnnotationMirror ann,
FlowControllerInfo fcInfo )
+ {
+ if ( ann == null ) return;
+ String val = CompilerUtils.getEnumFieldName( ann, NAVIGATE_TO_ATTR,
true );
+
+ if ( val != null )
+ {
+ if ( val.equals( NAVIGATE_TO_CURRENT_PAGE_STR ) || val.equals(
NAVIGATE_TO_PREVIOUS_PAGE_STR )
+ || val.equals( NAVIGATE_TO_PAGE_LEGACY_STR ) )
+ {
+ fcInfo.enableNavigateToPage();
+ }
+ else if ( val.equals( NAVIGATE_TO_PREVIOUS_ACTION_STR ) )
+ {
+ fcInfo.enableNavigateToAction();
}
}
}
@@ -279,12 +291,90 @@
getDiagnostics().addError( jclass, "error.web-inf-not-found",
sourceFile );
}
-
//
// Check the Jpf.Controller annotation on this class.
//
AnnotationMirror controllerAnnotation = CompilerUtils.getAnnotation(
jclass, CONTROLLER_TAG_NAME );
if ( controllerAnnotation != null ) _controllerGrammar.check(
controllerAnnotation, null, jclass );
+
+ //
+ // Check relative paths on Jpf.Catch, Jpf.Forward, and
Jpf.SimpleAction annotations on superclasses.
+ //
+ checkInheritedRelativePaths( jclass );
+ }
+
+ private void checkInheritedRelativePaths( ClassDeclaration jclass )
+ {
+ for ( ClassType type = jclass.getSuperclass();
+ type != null && CompilerUtils.isAssignableFrom(
FLOWCONTROLLER_BASE_CLASS, type, getEnv() );
+ type = type.getSuperclass() )
+ {
+ TypeDeclaration decl = CompilerUtils.getDeclaration( type );
+
+ List< AnnotationMirror > simpleActions =
+ CompilerUtils.getAnnotationArrayValue( decl,
CONTROLLER_TAG_NAME, SIMPLE_ACTIONS_ATTR, true );
+
+ if ( simpleActions != null )
+ {
+ for ( AnnotationMirror i : simpleActions )
+ {
+ checkRelativePath( i, jclass, decl );
+ List< AnnotationMirror > conditionalForwards =
+ CompilerUtils.getAnnotationArray( i,
CONDITIONAL_FORWARDS_ATTR, true );
+
+ if ( conditionalForwards != null )
+ {
+ for ( AnnotationMirror j : conditionalForwards )
+ {
+ checkRelativePath( j, jclass, decl );
+ }
+ }
+ }
+ }
+
+ List< AnnotationMirror > forwards =
+ CompilerUtils.getAnnotationArrayValue( decl,
CONTROLLER_TAG_NAME, FORWARDS_ATTR, true );
+
+ if ( forwards != null )
+ {
+ for ( AnnotationMirror i : forwards )
+ {
+ checkRelativePath( i, jclass, decl );
+ }
+ }
+
+ List< AnnotationMirror > catches =
+ CompilerUtils.getAnnotationArrayValue( decl,
CONTROLLER_TAG_NAME, CATCHES_ATTR, true );
+
+ if ( catches != null )
+ {
+ for ( AnnotationMirror i : catches )
+ {
+ checkRelativePath( i, jclass, decl );
+ }
+ }
+ }
+ }
+
+ private void checkRelativePath( AnnotationMirror ann, TypeDeclaration
jclass, TypeDeclaration baseType )
+ {
+ if ( ann != null )
+ {
+ AnnotationValue pathVal = CompilerUtils.getAnnotationValue( ann,
PATH_ATTR, true );
+
+ if ( pathVal != null )
+ {
+ String path = ( String ) pathVal.getValue();
+
+ if ( ! WebappPathType.relativePathExists( path, jclass,
getEnv() ) )
+ {
+ getDiagnostics().addWarning(
+ pathVal, "warning.inherited-file-not-found", path,
+ ANNOTATION_INTERFACE_PREFIX +
ann.getAnnotationType().getDeclaration().getSimpleName(),
+ baseType );
+ }
+ }
+ }
}
protected void checkField( FieldDeclaration field, TypeDeclaration jclass )
@@ -375,12 +465,21 @@
argTypeDecl.getQualifiedName() );
}
+ //
+ // Give a warning if there is no validationErrorForward
annotation and doValidation isn't set to false.
+ //
if ( CompilerUtils.getAnnotationValue( annotation,
VALIDATION_ERROR_FORWARD_ATTR, true ) == null
&& hasValidationAnnotations( argTypeDecl ) )
{
- getDiagnostics().addWarning( method,
"warning.validatable-formbean-no-forward",
- ANNOTATION_INTERFACE_PREFIX +
ACTION_TAG_NAME, VALIDATION_ERROR_FORWARD_ATTR,
-
VALIDATION_ERROR_FORWARD_ATTR, argTypeDecl.getQualifiedName() );
+ Boolean doValidation = CompilerUtils.getBoolean(
annotation, DO_VALIDATION_ATTR, true );
+
+ if ( doValidation == null || doValidation.booleanValue() )
+ {
+ getDiagnostics().addWarning(
+ method,
"warning.validatable-formbean-no-forward",
+ ANNOTATION_INTERFACE_PREFIX + ACTION_TAG_NAME,
VALIDATION_ERROR_FORWARD_ATTR,
+ VALIDATION_ERROR_FORWARD_ATTR,
argTypeDecl.getQualifiedName() );
+ }
}
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
Sat Jan 8 22:08:48 2005
@@ -139,6 +139,7 @@
public static final String FORWARDS_ATTR = "forwards";
public static final String CATCHES_ATTR = "catches";
public static final String VALIDATION_ERROR_FORWARD_ATTR =
"validationErrorForward";
+ public static final String DO_VALIDATION_ATTR = "doValidation";
public static final String LANGUAGE_ATTR = "language";
public static final String COUNTRY_ATTR = "country";
public static final String VARIANT_ATTR = "variant";
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/MergedControllerAnnotation.java
Sat Jan 8 22:08:48 2005
@@ -29,7 +29,7 @@
{
private String _strutsMerge;
private String _validatorMerge;
- private List< String > _tilesDefinitionsConfigs;
+ private List< String > _tilesDefsConfigs;
private boolean _nested;
private boolean _longLived;
private List< String > _rolesAllowed;
@@ -51,10 +51,6 @@
String validatorMerge = CompilerUtils.getString( controllerAnnotation,
VALIDATOR_MERGE_ATTR, true );
if ( validatorMerge != null ) _validatorMerge = validatorMerge;
- List< String > tilesDefinitionsConfigs =
- CompilerUtils.getStringArray( controllerAnnotation,
TILES_DEFINITIONS_CONFIGS_ATTR, true );
- if ( tilesDefinitionsConfigs != null ) _tilesDefinitionsConfigs =
tilesDefinitionsConfigs;
-
Boolean nested = CompilerUtils.getBoolean( controllerAnnotation,
NESTED_ATTR, true );
if ( nested != null ) _nested = nested;
@@ -67,9 +63,8 @@
Boolean readOnly = CompilerUtils.getBoolean( controllerAnnotation,
READONLY_ATTR, true );
if ( readOnly != null ) _readOnly = readOnly;
- List< String > rolesAllowed = CompilerUtils.getStringArray(
controllerAnnotation, ROLES_ALLOWED_ATTR, true );
- if ( rolesAllowed != null ) _rolesAllowed = rolesAllowed;
-
+ _rolesAllowed = mergeStringArray( _rolesAllowed, controllerAnnotation,
ROLES_ALLOWED_ATTR );
+ _tilesDefsConfigs = mergeStringArray( _tilesDefsConfigs,
controllerAnnotation, TILES_DEFINITIONS_CONFIGS_ATTR );
mergeAnnotationArray( _forwards, controllerAnnotation, FORWARDS_ATTR,
NAME_ATTR );
mergeAnnotationArray( _sharedFlowRefs, controllerAnnotation,
SHARED_FLOW_REFS_ATTR, NAME_ATTR );
mergeAnnotationArray( _catches, controllerAnnotation, CATCHES_ATTR,
TYPE_ATTR );
@@ -81,6 +76,20 @@
if ( multipartHandler != null ) _multipartHandler = multipartHandler;
}
+ private static List< String > mergeStringArray( List< String > memberList,
AnnotationMirror parentAnnotation,
+ String attr )
+ {
+ List< String > newList = CompilerUtils.getStringArray(
parentAnnotation, attr, true );
+
+ if ( newList != null )
+ {
+ if ( memberList == null ) return newList;
+ memberList.addAll( newList );
+ }
+
+ return memberList;
+ }
+
private static void mergeAnnotationArray( LinkedHashMap< String,
AnnotationMirror > keyedList,
AnnotationMirror
parentAnnotation, String attr, String keyAttr )
{
@@ -110,7 +119,7 @@
public List< String > getTilesDefinitionsConfigs()
{
- return _tilesDefinitionsConfigs;
+ return _tilesDefsConfigs;
}
public boolean isNested()
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/PageFlowChecker.java
Sat Jan 8 22:08:48 2005
@@ -39,11 +39,12 @@
import java.util.List;
import java.util.Set;
import java.util.HashSet;
-import java.util.LinkedHashMap;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
+
public class PageFlowChecker
extends FlowControllerChecker
@@ -140,7 +141,7 @@
// Add the dependency if it's a different file and if the file
exists (it may have been deleted
// sometime after the list of classes in this package got
built.
//
- if ( jpfFile != null && ! jpfFile.equals( file ) &&
file.exists() )
+ if ( jpfFile != null && ! jpfFile.equals( file ) && file !=
null && file.exists() )
{
overlapping.add( file.getName() );
overlappingFiles.add( file );
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/SharedFlowChecker.java
Sat Jan 8 22:08:48 2005
@@ -24,12 +24,11 @@
import org.apache.xmlbeans.XmlException;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.declaration.ClassDeclaration;
-import com.sun.mirror.declaration.TypeDeclaration;
-import com.sun.mirror.declaration.PackageDeclaration;
import java.io.File;
import java.io.IOException;
-import java.util.Collection;
+
+import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
public class SharedFlowChecker
extends FlowControllerChecker
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
Sat Jan 8 22:08:48 2005
@@ -166,3 +166,9 @@
error.field-not-assignable = This field must be of a type assignable from {0}.
error.no-matching-shared-flow-declared = There is no {0} annotation that
declares a shared flow with name "{1}".
+warning.annotated-abstract-method = This annotation will have no effect on an
abstract method.
+
+warning.inherited-file-not-found =
+File "{0}" (reference inherited from a {1} annotation on {2}) could not be
found in the web application.
+
+error.validate-with-no-validation-error-forward = The {0} attribute requires a
value for {1} when set to true.
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenActionModel.java
Sat Jan 8 22:08:48 2005
@@ -112,12 +112,20 @@
// validationErrorForward -- the forward used when validation fails
//
AnnotationMirror validateErrFwd = CompilerUtils.getAnnotation(
annotation, VALIDATION_ERROR_FORWARD_ATTR, true );
+ boolean doValidation = false;
if ( validateErrFwd != null )
{
ForwardModel fwd = new GenForwardModel( parentApp, validateErrFwd,
jclass, " (validationErrorForward)" );
addForward( fwd );
setInput( fwd.getName() );
+ doValidation = true;
}
+
+ //
+ // validate
+ //
+ Boolean explicitDoValidation = CompilerUtils.getBoolean( annotation,
DO_VALIDATION_ATTR, true );
+ setValidate( explicitDoValidation != null ? explicitDoValidation :
doValidation );
//
// exception-catches
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ActionGrammar.java
Sat Jan 8 22:08:48 2005
@@ -21,7 +21,13 @@
import org.apache.beehive.netui.compiler.AnnotationMemberType;
import org.apache.beehive.netui.compiler.FlowControllerInfo;
import org.apache.beehive.netui.compiler.Diagnostics;
+import org.apache.beehive.netui.compiler.CompilerUtils;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.AnnotationMirror;
+import com.sun.mirror.declaration.MemberDeclaration;
+import com.sun.mirror.declaration.Modifier;
+import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
+import com.sun.mirror.declaration.AnnotationValue;
import static org.apache.beehive.netui.compiler.JpfLanguageConstants.*;
@@ -40,6 +46,7 @@
addMemberType( USE_FORM_BEAN_ATTR,
new WritableFieldType( OBJECT_CLASS_NAME,
USE_FORM_BEAN_ATTR, VERSION_8_SP2_STRING, this ) );
addMemberType( PREVENT_DOUBLE_SUBMIT_ATTR, new AnnotationMemberType(
null, this ) );
+ addMemberType( DO_VALIDATION_ATTR, new DoValidateType() );
addMemberArrayGrammar( FORWARDS_ATTR, new ForwardGrammar( env, diags,
null, rvc, fcInfo ) );
addMemberArrayGrammar( CATCHES_ATTR, new CatchGrammar( env, diags,
null, rvc, ACTION_TAG_NAME, fcInfo ) );
@@ -55,6 +62,47 @@
public String[][] getRequiredAttrs()
{
return null;
+ }
+
+ protected boolean onBeginCheck( AnnotationMirror annotation,
AnnotationMirror[] parentAnnotations,
+ MemberDeclaration classMember )
+ {
+ if ( CompilerUtils.hasModifier( classMember, Modifier.ABSTRACT ) )
+ {
+ addWarning( annotation, "warning.annotated-abstract-method" );
+ return false;
+ }
+
+ return true;
+ }
+
+ private class DoValidateType
+ extends AnnotationMemberType
+ {
+ public DoValidateType()
+ {
+ super( null, ActionGrammar.this );
+ }
+
+ public Object onCheck( AnnotationTypeElementDeclaration valueDecl,
AnnotationValue member,
+ AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
+ {
+ //
+ // If this value is set to true, there must be a value for
validationErrorForward.
+ //
+ if ( ( Boolean ) member.getValue() )
+ {
+ AnnotationMirror parentAnnotation = parentAnnotations[
parentAnnotations.length - 1 ];
+
+ if ( CompilerUtils.getAnnotation( parentAnnotation,
VALIDATION_ERROR_FORWARD_ATTR, true ) == null )
+ {
+ addError( member,
"error.validate-with-no-validation-error-forward", DO_VALIDATION_ATTR,
+ VALIDATION_ERROR_FORWARD_ATTR );
+ }
+ }
+
+ return null;
+ }
}
private class ActionForwardGrammar
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ExceptionHandlerGrammar.java
Sat Jan 8 22:08:48 2005
@@ -27,6 +27,7 @@
import com.sun.mirror.declaration.MemberDeclaration;
import com.sun.mirror.declaration.MethodDeclaration;
import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.Modifier;
import java.util.Collection;
import java.util.List;
@@ -49,6 +50,12 @@
protected boolean onBeginCheck( AnnotationMirror annotation,
AnnotationMirror[] parentAnnotations,
MemberDeclaration classMember )
{
+ if ( CompilerUtils.hasModifier( classMember, Modifier.ABSTRACT ) )
+ {
+ addWarning( annotation, "warning.annotated-abstract-method" );
+ return false;
+ }
+
TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
String thisMethodName = classMember.getSimpleName();
Collection< MethodDeclaration > classMethods =
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/SimpleActionGrammar.java
Sat Jan 8 22:08:48 2005
@@ -34,7 +34,7 @@
public class SimpleActionGrammar
- extends BaseFlowControllerGrammar
+ extends ActionGrammar
{
private static String[][] MUTUALLY_EXCLUSIVE_ATTRS =
{
@@ -47,21 +47,10 @@
public SimpleActionGrammar( AnnotationProcessorEnvironment env,
Diagnostics diags, RuntimeVersionChecker rvc,
FlowControllerInfo fcInfo )
{
- super( env, diags, VERSION_9_0_STRING, rvc, fcInfo );
-
- addMemberType( LOGIN_REQUIRED_ATTR, new AnnotationMemberType( null,
this ) );
- addMemberType( ROLES_ALLOWED_ATTR, new RolesAllowedType( this ) );
- addMemberType( READONLY_ATTR, new AnnotationMemberType(
VERSION_8_SP2_STRING, this ) );
- addMemberType( USE_FORM_BEAN_ATTR,
- new WritableFieldType( OBJECT_CLASS_NAME,
USE_FORM_BEAN_ATTR, VERSION_8_SP2_STRING, this ) );
- addMemberType( PREVENT_DOUBLE_SUBMIT_ATTR, new AnnotationMemberType(
null, this ) );
- addMemberType( PREVENT_DOUBLE_SUBMIT_ATTR, new AnnotationMemberType(
null, this ) );
+ super( env, diags, rvc, fcInfo );
addMemberArrayGrammar( CONDITIONAL_FORWARDS_ATTR,
new SimpleActionForwardGrammar( env, diags,
null, rvc, fcInfo ) );
- addMemberArrayGrammar( CATCHES_ATTR, new CatchGrammar( env, diags,
null, rvc, ACTION_TAG_NAME, fcInfo ) );
- addMemberArrayGrammar( VALIDATABLE_PROPERTIES_ATTR, new
ValidatablePropertyGrammar( env, diags, rvc ) );
- addMemberGrammar( VALIDATION_ERROR_FORWARD_ATTR, new ForwardGrammar(
env, diags, null, rvc, fcInfo ) );
//
// The rest of the attributes are checked by ForwardGrammar.
@@ -86,7 +75,7 @@
//
_forwardGrammar.check( annotation, parentAnnotations, classMember );
- return super.onBeginCheck( annotation, parentAnnotations, classMember
);
+ return true;
}
public String[][] getMutuallyExclusiveAttrs()
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ValidatablePropertyGrammar.java
Sat Jan 8 22:08:48 2005
@@ -79,10 +79,18 @@
if ( actionAnnotation != null ) // if it's null, we're in the
Controller annotation -- no checks for that
{
+ //
+ // Give a warning if there is no validationErrorForward annotation
and doValidation isn't set to false.
+ //
if ( CompilerUtils.getAnnotationValue( actionAnnotation,
VALIDATION_ERROR_FORWARD_ATTR, true ) == null )
{
- addWarning( annotation,
"warning.validation-annotations-no-forward",
- ANNOTATION_INTERFACE_PREFIX + ACTION_TAG_NAME,
VALIDATION_ERROR_FORWARD_ATTR );
+ Boolean doValidation = CompilerUtils.getBoolean(
actionAnnotation, DO_VALIDATION_ATTR, true );
+
+ if ( doValidation == null || doValidation.booleanValue() )
+ {
+ addWarning( annotation,
"warning.validation-annotations-no-forward",
+ ANNOTATION_INTERFACE_PREFIX + ACTION_TAG_NAME,
VALIDATION_ERROR_FORWARD_ATTR );
+ }
}
}
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/WebappPathType.java
Sat Jan 8 22:08:48 2005
@@ -28,6 +28,8 @@
import com.sun.mirror.declaration.MemberDeclaration;
import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.Modifier;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import java.net.URISyntaxException;
import java.net.URI;
@@ -107,6 +109,7 @@
boolean fileExists = true;
File jpfFile = CompilerUtils.getOriginalFile(
CompilerUtils.getOuterClass( classMember ) );
+ TypeDeclaration outerClass = CompilerUtils.getOutermostClass(
classMember );
File fileToCheck = null;
if ( filePath.charAt( 0 ) == '/' ) // relative to webapp root
@@ -127,7 +130,7 @@
if ( fileToCheck == null )
{
- File webappRoot = getWebFilesRoot( jpfFile, true );
+ File webappRoot = getWebFilesRoot( jpfFile, true, getEnv() );
fileToCheck = new File( webappRoot + filePath );
if ( ! fileToCheck.exists() && ! ( ignoreDirectories() &&
fileToCheck.isDirectory() ) )
@@ -138,56 +141,17 @@
}
//
- // In certain error conditions, we can't determine the file. In this
case, just ignore.
- //
- else if ( jpfFile != null && filePath.indexOf( '/' ) != 0 ) // under
this pageflow's directory
- {
- if ( filePath.endsWith( JPF_FILE_EXTENSION_DOT ) )
- {
- String className = filePath.substring( 0, filePath.length() -
JPF_FILE_EXTENSION_DOT.length() );
- String pkg = CompilerUtils.getOutermostClass( classMember
).getPackage().getQualifiedName();
- while ( className.startsWith( "../" ) && className.length() >
3 )
- {
- className = className.substring( 3 );
- int lastDot = pkg.lastIndexOf( '.' );
- pkg = lastDot != -1 ? pkg.substring( 0, lastDot ) : "";
- }
- className = ( pkg.length() > 0 ? pkg + '.' : "" ) +
className.replace( '/', '.' );
- TypeDeclaration type = getEnv().getTypeDeclaration( className
);
- fileToCheck = type != null ? CompilerUtils.getOriginalFile(
type ) : null;
- if ( fileToCheck == null ) fileExists = false;
- }
- else
- {
- File webappRoot = getWebFilesRoot( jpfFile, false );
- File webFilesRoot = getWebFilesRoot( jpfFile, true );
- File jpfParent = jpfFile.getAbsoluteFile().getParentFile();
- assert jpfParent.getPath().startsWith( webappRoot.getPath() )
: jpfParent.getPath();
- String jpfParentRelativePath = jpfParent.getPath().substring(
webappRoot.getPath().length() );
-
- //
- // Check if this page flow is in WEB-INF/src. If so, the
"local" dir is actually out
- // in the web-addressable part of the webapp, unless we're
looking for a .jpf (in the
- // case that there's a forward to the current page flow from
within the page flow).
- //
- if ( ! mustBeInPageFlowDir() )
- {
- jpfParentRelativePath = jpfParentRelativePath.replace(
'\\', '/' );
-
- if ( jpfParentRelativePath.startsWith( WEBINF_SRC_PATH ) )
- {
- jpfParentRelativePath =
jpfParentRelativePath.substring( WEBINF_SRC_PATH.length() );
- }
- }
-
- File desiredParentDir = new File( webFilesRoot +
jpfParentRelativePath );
- fileToCheck = new File( desiredParentDir, filePath );
-
- if ( ! fileToCheck.exists() && ! ( ignoreDirectories() &&
fileToCheck.isDirectory() ) )
- {
- fileExists = false;
- }
- }
+ // In certain error conditions (jpfFile == null), we can't determine
the file. In this case, just ignore.
+ // Also, if the class being compiled is abstract, don't print warnings
for relative-path files that aren't
+ // found. The derived class might have them.
+ //
+ else if ( jpfFile != null && filePath.indexOf( '/' ) != 0
+ && ! CompilerUtils.hasModifier( outerClass,
Modifier.ABSTRACT ) )
+ {
+ CompilerUtils.Mutable< File > retFileToCheck = new
CompilerUtils.Mutable< File >();
+ fileExists = checkRelativePath( filePath, outerClass, jpfFile,
retFileToCheck, ignoreDirectories(),
+ mustBeInPageFlowDir(), getEnv() );
+ fileToCheck = retFileToCheck.get();
}
if ( fileExists )
@@ -211,19 +175,86 @@
return null;
}
- protected File getWebFilesRoot( File jpfFile, boolean useAlternateLocation
)
+ public static boolean relativePathExists( String filePath, TypeDeclaration
outerClass,
+ AnnotationProcessorEnvironment
env )
+ {
+ File jpfFile = CompilerUtils.getOriginalFile(
CompilerUtils.getOuterClass( outerClass ) );
+ return checkRelativePath( filePath, outerClass, jpfFile, null, true,
false, env );
+ }
+
+ private static boolean checkRelativePath( String filePath, TypeDeclaration
outerClass,
+ File jpfFile,
CompilerUtils.Mutable< File > retFileToCheck,
+ boolean ignoreDirectories,
boolean mustBeInPageFlowDir,
+ AnnotationProcessorEnvironment
env )
+ {
+ File fileToCheck;
+ boolean fileExists = true;
+
+ if ( filePath.endsWith( JPF_FILE_EXTENSION_DOT ) )
+ {
+ String className = filePath.substring( 0, filePath.length() -
JPF_FILE_EXTENSION_DOT.length() );
+ String pkg = outerClass.getPackage().getQualifiedName();
+ while ( className.startsWith( "../" ) && className.length() > 3 )
+ {
+ className = className.substring( 3 );
+ int lastDot = pkg.lastIndexOf( '.' );
+ pkg = lastDot != -1 ? pkg.substring( 0, lastDot ) : "";
+ }
+ className = ( pkg.length() > 0 ? pkg + '.' : "" ) +
className.replace( '/', '.' );
+ TypeDeclaration type = env.getTypeDeclaration( className );
+ fileToCheck = type != null ? CompilerUtils.getOriginalFile( type )
: null;
+ if ( fileToCheck == null ) fileExists = false;
+ }
+ else
+ {
+ File webappRoot = getWebFilesRoot( jpfFile, false, env );
+ File webFilesRoot = getWebFilesRoot( jpfFile, true, env );
+ File jpfParent = jpfFile.getAbsoluteFile().getParentFile();
+ assert jpfParent.getPath().startsWith( webappRoot.getPath() ) :
jpfParent.getPath();
+ String jpfParentRelativePath = jpfParent.getPath().substring(
webappRoot.getPath().length() );
+
+ //
+ // Check if this page flow is in WEB-INF/src. If so, the "local"
dir is actually out
+ // in the web-addressable part of the webapp, unless we're looking
for a .jpf (in the
+ // case that there's a forward to the current page flow from
within the page flow).
+ //
+ if ( ! mustBeInPageFlowDir )
+ {
+ jpfParentRelativePath = jpfParentRelativePath.replace( '\\',
'/' );
+
+ if ( jpfParentRelativePath.startsWith( WEBINF_SRC_PATH ) )
+ {
+ jpfParentRelativePath = jpfParentRelativePath.substring(
WEBINF_SRC_PATH.length() );
+ }
+ }
+
+ File desiredParentDir = new File( webFilesRoot +
jpfParentRelativePath );
+ fileToCheck = new File( desiredParentDir, filePath );
+
+ if ( ! fileToCheck.exists() && ! ( ignoreDirectories &&
fileToCheck.isDirectory() ) )
+ {
+ fileExists = false;
+ }
+ }
+
+ if ( retFileToCheck != null ) retFileToCheck.set( fileToCheck );
+ return fileExists;
+ }
+
+ protected static File getWebFilesRoot( File jpfFile, boolean
useAlternateLocation,
+ AnnotationProcessorEnvironment env )
{
try
{
String alternateRoot = null;
if ( useAlternateLocation )
{
- alternateRoot = getEnv().getOptions().get(
ALTERNATE_WEB_ROOT_DIR_OPTION );
+ alternateRoot = env.getOptions().get(
ALTERNATE_WEB_ROOT_DIR_OPTION );
// TODO: there appears to be a bug in APT where both the
key/value are contained in the key
if ( alternateRoot == null )
{
- for ( Object i : getEnv().getOptions().keySet() )
+ for ( Object i : env.getOptions().keySet() )
{
String key = ( String ) i;
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java&r1=124707&p2=incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
(original)
+++
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
Sat Jan 8 22:08:48 2005
@@ -60,6 +60,7 @@
private String _type;
private boolean _unknown;
private String _roles;
+ private boolean _validate;
// Non-struts attributes.
private String _unqualifiedActionPath;
@@ -106,6 +107,7 @@
_forward = src._forward;
_include = src._include;
_input = src._input;
+ _validate = src._validate;
_parameter = src._parameter;
_prefix = src._prefix;
_scope = src._scope;
@@ -217,7 +219,7 @@
if ( xb.getValidate() == null )
{
- xb.setValidate( _input != null ? Action.Validate.TRUE :
Action.Validate.FALSE );
+ xb.setValidate( _validate ? Action.Validate.TRUE :
Action.Validate.FALSE );
}
if ( _unqualifiedActionPath != null ) addSetProperty( xb,
"unqualifiedActionPath", _unqualifiedActionPath );
@@ -373,6 +375,16 @@
public void setParameter( String parameter )
{
this._parameter = parameter;
+ }
+
+ public boolean isValidate()
+ {
+ return _validate;
+ }
+
+ public void setValidate( boolean validate )
+ {
+ _validate = validate;
}
public String getPath()
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java&r1=124707&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
Sat Jan 8 22:08:48 2005
@@ -1196,7 +1196,7 @@
* of whether <code>return-to="previousAction"</code> is used.
* @see PageFlowController#getPreviousActionInfo
* @see PageFlowController#getPreviousActionURI
- * @see PageFlowController#getPreviousForm
+ * @see PageFlowController#getPreviousFormBean
*/
protected boolean alwaysTrackPreviousAction()
{
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java&r1=124707&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
Sat Jan 8 22:08:48 2005
@@ -21,7 +21,6 @@
import org.apache.beehive.netui.util.config.ConfigUtil;
import org.apache.beehive.netui.util.config.bean.PageflowConfig;
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.internal.InternalConstants;
import org.apache.beehive.netui.pageflow.config.PageFlowControllerConfig;
import javax.servlet.http.HttpServletRequest;
@@ -152,7 +151,14 @@
}
else
{
- sf = getSharedFlow( className, request, response,
servletContext );
+ try
+ {
+ sf = getSharedFlow( className, request,
response, servletContext );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ _log.error( "Requested shared flow class " +
className + " not found." );
+ }
}
if ( sf != null && ! ( sf instanceof GlobalApp ) )
sharedFlows.put( name, sf );
@@ -174,7 +180,7 @@
}
else
{
- getSharedFlow( InternalConstants.GLOBALAPP_CLASSNAME, request,
response, servletContext );
+ getGlobalApp( request, response, servletContext );
}
return null;
@@ -216,28 +222,33 @@
public static GlobalApp getGlobalApp( HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext )
{
- SharedFlowController sf =
- getSharedFlow( PageFlowConstants.GLOBALAPP_CLASSNAME, request,
response, servletContext );
- return sf instanceof GlobalApp ? ( GlobalApp ) sf : null;
- }
-
- public static SharedFlowController getSharedFlow( String
sharedFlowClassName, HttpServletRequest request,
- HttpServletResponse
response, ServletContext servletContext )
- {
try
{
- Class sfClass = InternalUtils.getReloadableClass(
sharedFlowClassName, request, servletContext );
- return getSharedFlow( sfClass, request, response, servletContext );
- }
- catch ( ClassNotFoundException e )
- {
- if ( _log.isErrorEnabled() )
+ SharedFlowController sf =
+ getSharedFlow( PageFlowConstants.GLOBALAPP_CLASSNAME,
request, response, servletContext );
+
+ if ( ! ( sf instanceof GlobalApp ) )
{
- _log.error( "Requested SharedFlowController class " +
sharedFlowClassName + " not found." );
+ _log.error( "Class " + PageFlowConstants.GLOBALAPP_CLASSNAME +
" is not an instance of "
+ + GlobalApp.class.getName() );
+ return null;
}
+ return ( GlobalApp ) sf;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ // Ignore -- this is expected if there's no (legacy) Global.app.
return null;
}
+ }
+
+ public static SharedFlowController getSharedFlow( String
sharedFlowClassName, HttpServletRequest request,
+ HttpServletResponse
response, ServletContext servletContext )
+ throws ClassNotFoundException
+ {
+ Class sfClass = InternalUtils.getReloadableClass( sharedFlowClassName,
request, servletContext );
+ return getSharedFlow( sfClass, request, response, servletContext );
}
private static ModuleConfig ensureModule( String modulePath,
HttpServletRequest request,
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java&r1=124707&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
Sat Jan 8 22:08:48 2005
@@ -40,6 +40,8 @@
import org.apache.beehive.netui.pageflow.internal.CachedSharedFlowRefInfo;
import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
import static org.apache.beehive.netui.pageflow.internal.InternalConstants.*;
@@ -301,12 +303,12 @@
}
/**
- * Get the form instance from the most recent action execution in this
PageFlowController.
+ * Get the submitted form bean from the most recent action execution in
this PageFlowController.
* <p>
- * <i>Note: if the current page flow does not use a
</i><code>@jpf:forward</code><i> with a</i>
- * <code>return-to="previousAction"</code><i> attribute, then this method
will always return
- * </i><code>null</code><i> by default. To enable it in this situation,
add the following method
- * to the page flow:</i><br>
+ * <i>Note: if the current page flow does not contain a </i>[EMAIL
PROTECTED] Jpf.Forward}<i> or a
+ * </i>[EMAIL PROTECTED] Jpf.SimpleAction}<i> with a </i><code>[EMAIL
PROTECTED] Jpf.NavigateTo.previousAction}</code><i>
+ * attribute, then this method will always return </i><code>null</code><i>
by default. To enable it in this
+ * situation, add the following method to the page flow:</i><br>
* <blockquote>
* <code>
* protected boolean alwaysTrackPreviousAction()<br>
@@ -316,8 +318,10 @@
* </code>
* </blockquote>
*
+ * @deprecated This method may return an <code>ActionForm</code> wrapper
when the form bean type does not extend
+ * <code>ActionForm</code>. Use [EMAIL PROTECTED]
#getPreviousFormBean} instead.
* @return the ActionForm instance from the most recent action execution,
or <code>null</code>
- * if there was no ActionForm instance.
+ * if there was no form bean submitted.
* @see #getPreviousPageInfo
* @see #getCurrentPageInfo
* @see #getPreviousActionInfo
@@ -327,10 +331,42 @@
*/
protected ActionForm getPreviousForm()
{
+ checkPreviousActionInfoDisabled();
return _previousActionInfo != null ? _previousActionInfo.getForm() :
null;
}
/**
+ * Get the submitted form bean from the most recent action execution in
this PageFlowController.
+ * <p>
+ * <i>Note: if the current page flow does not contain a </i>[EMAIL
PROTECTED] Jpf.Forward}<i> or a
+ * </i>[EMAIL PROTECTED] Jpf.SimpleAction}<i> with a </i><code>[EMAIL
PROTECTED] Jpf.NavigateTo.previousAction}</code><i>
+ * attribute, then this method will always return </i><code>null</code><i>
by default. To enable it in this
+ * situation, add the following method to the page flow:</i><br>
+ * <blockquote>
+ * <code>
+ * protected boolean alwaysTrackPreviousAction()<br>
+ * {<br>
+ * return true;<br>
+ * }<br>
+ * </code>
+ * </blockquote>
+ *
+ * @return the form bean instance from the most recent action execution,
or <code>null</code>
+ * if there was no form bean submitted.
+ * @see #getPreviousPageInfo
+ * @see #getCurrentPageInfo
+ * @see #getPreviousActionInfo
+ * @see #getPreviousActionURI
+ * @see #getPreviousForwardPath
+ * @see #getCurrentForwardPath
+ */
+ protected Object getPreviousFormBean()
+ {
+ checkPreviousActionInfoDisabled();
+ return _previousActionInfo != null ? InternalUtils.unwrapFormBean(
_previousActionInfo.getForm() ) : null;
+ }
+
+ /**
* Get the URI for the most recent action in this PageFlowController.
* <p>
* <i>Note: if the current page flow does not use a
</i><code>@jpf:forward</code><i> with a</i>
@@ -350,12 +386,13 @@
* @see #getPreviousPageInfo
* @see #getCurrentPageInfo
* @see #getPreviousActionInfo
- * @see #getPreviousForm
+ * @see #getPreviousFormBean
* @see #getPreviousForwardPath
* @see #getCurrentForwardPath
*/
protected String getPreviousActionURI()
{
+ checkPreviousActionInfoDisabled();
return _previousActionInfo != null ?
_previousActionInfo.getActionURI() : null;
}
@@ -380,7 +417,7 @@
* @see #getCurrentPageInfo
* @see #getPreviousActionInfo
* @see #getPreviousActionURI
- * @see #getPreviousForm
+ * @see #getPreviousFormBean
* @see #getPreviousForwardPath
*/
protected String getCurrentForwardPath()
@@ -428,7 +465,7 @@
* @see #getCurrentPageInfo
* @see #getPreviousActionInfo
* @see #getPreviousActionURI
- * @see #getPreviousForm
+ * @see #getPreviousFormBean
* @see #getCurrentForwardPath
*/
protected String getPreviousForwardPath()
@@ -478,12 +515,14 @@
* @see #getPreviousPageInfo
* @see #getPreviousActionInfo
* @see #getPreviousActionURI
- * @see #getPreviousForm
+ * @see #getPreviousFormBean
* @see #getPreviousForwardPath
* @see #getCurrentForwardPath
*/
public final PreviousPageInfo getCurrentPageInfo()
{
+ checkPreviousPageInfoDisabled();
+
if ( _currentPageInfo != null )
{
// Allows it to reconstruct transient members after session
failover
@@ -514,12 +553,14 @@
* @see #getCurrentPageInfo
* @see #getPreviousActionInfo
* @see #getPreviousActionURI
- * @see #getPreviousForm
+ * @see #getPreviousFormBean
* @see #getPreviousForwardPath
* @see #getCurrentForwardPath
*/
public final PreviousPageInfo getPreviousPageInfo()
{
+ checkPreviousPageInfoDisabled();
+
PreviousPageInfo ret = _previousPageInfo != null ? _previousPageInfo :
_currentPageInfo;
if ( ret != null )
@@ -550,20 +591,55 @@
* @see #getPreviousPageInfo
* @see #getCurrentPageInfo
* @see #getPreviousActionURI
- * @see #getPreviousForm
+ * @see #getPreviousFormBean
* @see #getPreviousForwardPath
* @see #getCurrentForwardPath
*/
public final PreviousActionInfo getPreviousActionInfo()
{
+ checkPreviousActionInfoDisabled();
return _previousActionInfo;
}
+ private void checkPreviousActionInfoDisabled()
+ {
+ if ( isPreviousActionInfoDisabled() )
+ {
+ throw new IllegalStateException( "Previous action information has
been disabled in this page flow. Override alwaysTrackPreviousAction() to
enable it." );
+ }
+ }
+
+ private void checkPreviousPageInfoDisabled()
+ {
+ if ( isPreviousPageInfoDisabled() )
+ {
+ throw new IllegalStateException( "Previous page information has
been disabled in this page flow. Override alwaysTrackPreviousPage() to enable
it." );
+ }
+ }
+
public String getDisplayName()
{
return getURI();
}
+ private boolean isPreviousActionInfoDisabled()
+ {
+ if ( alwaysTrackPreviousAction() ) return false;
+
+ ModuleConfig mc = getModuleConfig();
+ ControllerConfig cc = mc.getControllerConfig();
+ return cc instanceof PageFlowControllerConfig && ( (
PageFlowControllerConfig ) cc ).isReturnToActionDisabled();
+ }
+
+ private boolean isPreviousPageInfoDisabled()
+ {
+ if ( alwaysTrackPreviousPage() ) return false;
+
+ ModuleConfig mc = getModuleConfig();
+ ControllerConfig cc = mc.getControllerConfig();
+ return cc instanceof PageFlowControllerConfig && ( (
PageFlowControllerConfig ) cc ).isReturnToPageDisabled();
+ }
+
/**
* Called from [EMAIL PROTECTED] FlowController#execute}.
*/
@@ -573,13 +649,7 @@
//
// If previous-action is disabled (unused in this pageflow), just
return.
//
- ModuleConfig mc = getModuleConfig();
- ControllerConfig cc = mc.getControllerConfig();
- if ( cc instanceof PageFlowControllerConfig && ( (
PageFlowControllerConfig ) cc ).isReturnToActionDisabled() )
- {
- if ( ! alwaysTrackPreviousAction() ) return;
- }
-
+ if ( isPreviousActionInfoDisabled() ) return;
String actionURI = PageFlowUtils.getRelativeURI( request, null );
_previousActionInfo = new PreviousActionInfo( form, actionURI,
request.getQueryString() );
}
@@ -594,12 +664,7 @@
//
// If previous-page is disabled (unused in this pageflow), just return.
//
- ModuleConfig mc = getModuleConfig();
- ControllerConfig cc = mc.getControllerConfig();
- if ( cc instanceof PageFlowControllerConfig && ( (
PageFlowControllerConfig ) cc ).isReturnToPageDisabled() )
- {
- if ( ! alwaysTrackPreviousPage() ) return;
- }
+ if ( isPreviousPageInfoDisabled() ) return;
if ( forward != null )
{
@@ -612,10 +677,25 @@
}
//
+ // If a form bean was generated in this request, add it to the
most recent PreviousPageInfo, so when we
+ // go back to that page, the *updated* field values are restored
(i.e., we don't revert to the values of
+ // the form that was passed into the page originally).
+ //
+ if ( form != null && _currentPageInfo != null )
+ {
+ ActionForm oldForm = _currentPageInfo.getForm();
+ if ( oldForm == null || oldForm.getClass().equals(
form.getClass() ) )
+ {
+ _currentPageInfo.setForm( form );
+ _currentPageInfo.setMapping( mapping );
+ }
+ }
+
+ //
// Only keep track of *pages* forwarded to -- not actions or
pageflows.
//
if ( ! FileUtils.osSensitiveEndsWith( path, ACTION_EXTENSION ) )
- {
+ {
//
// Only save previous-page info if the page is within this
pageflow.
//
@@ -747,21 +827,23 @@
final void beforePage()
{
- HttpServletRequest request = getRequest();
- String relativeUri = PageFlowUtils.getRelativeURI( request, null );
-
//
- // We may need to save the previous page info if the JSP was called
directly
- // and we do not yet have the forward path in the page flow or it is a
different
- // path.
- //
- String path = getCurrentForwardPath();
- if ( path == null || ! path.equals( relativeUri ) )
- {
- ActionForward actionForward = new ActionForward( relativeUri );
- actionForward.setContextRelative( true );
- actionForward.setRedirect( false );
- savePreviousPageInfo( actionForward, null, null, request,
getServletContext(), false );
+ // We may need to save the previous page info if the page was called
directly (not forwarded through an action)
+ // and we do not yet have the forward path in the page flow or it is a
different path.
+ //
+ if ( ! isPreviousPageInfoDisabled() )
+ {
+ HttpServletRequest request = getRequest();
+ String relativeUri = PageFlowUtils.getRelativeURI( request, null );
+
+ String path = getCurrentForwardPath();
+ if ( path == null || ! path.equals( relativeUri ) )
+ {
+ ActionForward actionForward = new ActionForward( relativeUri );
+ actionForward.setContextRelative( true );
+ actionForward.setRedirect( false );
+ savePreviousPageInfo( actionForward, null, null, request,
getServletContext(), false );
+ }
}
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java&r1=124707&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
Sat Jan 8 22:08:48 2005
@@ -230,6 +230,12 @@
Forward validationErrorForward() default @Jpf.Forward( name="" );
/**
+ * Turn form validation on or off for this action.
+ * If [EMAIL PROTECTED] #validationErrorForward()} is not empty, this
value is set to <code>true</code>automatically.
+ */
+ boolean doValidation() default false;
+
+ /**
* Prevent multiple submits to this action. If multiple submits
occur, a
* [EMAIL PROTECTED]
org.apache.beehive.netui.pageflow.DoubleSubmitException} is thrown.
*/
@@ -283,6 +289,12 @@
* forward used when validation fails
*/
Forward validationErrorForward() default @Jpf.Forward( name="" );
+
+ /**
+ * Turn form validation on or off for this action.
+ * If [EMAIL PROTECTED] #validationErrorForward()} is not empty, this
value is set to <code>true</code>automatically.
+ */
+ boolean doValidation() default false;
/**
* The forward path. Mutually-exclusive with
<code>tilesDefinition</code>,
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java&r1=124707&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
Sat Jan 8 22:08:48 2005
@@ -44,6 +44,7 @@
import org.apache.beehive.netui.pageflow.FormData;
import org.apache.beehive.netui.pageflow.PageFlowController;
import org.apache.beehive.netui.pageflow.SharedFlowController;
+import org.apache.beehive.netui.pageflow.PageFlowManagedObjectException;
import org.apache.beehive.netui.pageflow.handler.ExceptionsHandler;
import org.apache.beehive.netui.util.Bundle;
import org.apache.beehive.netui.util.cache.ClassLevelCache;
@@ -368,9 +369,9 @@
//
boolean prodMode = ServerAdapterManager.getServerAdapter(
servletContext ).isInProductionMode();
- if ( ! prodMode && ex instanceof PageFlowException )
+ if ( ! prodMode && ex instanceof PageFlowManagedObjectException )
{
- ( ( PageFlowException ) ex ).sendError( request, response );
+ ( ( PageFlowManagedObjectException ) ex ).sendError( request,
response );
return true;
}
}
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java&r1=124707&p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Sat Jan 8 22:08:48 2005
@@ -710,48 +710,6 @@
}
/**
- * Get or create the current [EMAIL PROTECTED] SharedFlowController}
instance.
- *
- * @param request the current HttpServletRequest.
- * @param response the current HttpServletResponse
- * @return the current applicable [EMAIL PROTECTED] SharedFlowController}
from the user session, or a newly-instantiated one
- * if none was in the session. Failing that, return
<code>null</code>.
- */
- public static SharedFlowController ensureSharedFlow( HttpServletRequest
request, HttpServletResponse response )
- {
- return ensureSharedFlow( request, response, getServletContext( request
) );
- }
-
- /**
- * Get or create the current [EMAIL PROTECTED] SharedFlowController}
instance.
- *
- * @param request the current HttpServletRequest.
- * @param response the current HttpServletResponse
- * @param servletContext the current ServletContext
- * @return the current applicable [EMAIL PROTECTED] SharedFlowController}
from the user session, or a newly-instantiated one
- * if none was in the session. Failing that, return
<code>null</code>.
- */
- public static SharedFlowController ensureSharedFlow( HttpServletRequest
request, HttpServletResponse response,
- ServletContext
servletContext )
- {
- assert request != null;
- assert response != null;
-
- String sharedFlowClassName = getSharedFlowClassName( request,
servletContext );
- SharedFlowController cur = PageFlowUtils.getSharedFlow(
sharedFlowClassName, request );
-
- if ( cur != null )
- {
- cur.reinitialize( request, response, servletContext );
- return cur;
- }
- else
- {
- return FlowControllerFactory.getSharedFlow( sharedFlowClassName,
request, response, servletContext );
- }
- }
-
- /**
* Set the current ActionResolver ([EMAIL PROTECTED] PageFlowController})
in the user session.
*
* @param resolver the ActionResolver to set as the current one in the
user session.
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/Controller.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/Controller.jpf?view=auto&rev=124708
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/Controller.jpf
Sat Jan 8 22:08:48 2005
@@ -0,0 +1,145 @@
+package miniTests.updateFormFromNested;
+
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+
[EMAIL PROTECTED](
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp"),
+ @Jpf.SimpleAction(name="zipCancel",
navigateTo=Jpf.NavigateTo.currentPage)
+ }
+)
+public class Controller extends PageFlowController
+{
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name="success",
+ navigateTo=Jpf.NavigateTo.currentPage
+ )
+ }
+ )
+ protected Forward zipSuccess( String zip )
+ {
+ SubmitForm previousForm = ( SubmitForm ) getPreviousFormBean();
+ previousForm.setZip( zip );
+ Forward success = new Forward( "success", previousForm );
+ return success;
+ }
+
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name = "success",
+ path = "results.jsp"
+ )
+ },
+ [EMAIL PROTECTED](name="fail", navigateTo=Jpf.NavigateTo.currentPage)
+ )
+ protected Forward submit(SubmitForm form)
+ {
+ return new Forward("success", "form", form );
+ }
+
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name = "getZipFlow",
+ path = "getZip/GetZip.jpf"
+ )
+ },
+ doValidation=false
+ )
+ /**
+ * This action forwards to the nested page flow to gather the zip. Note
that it takes a
+ * SubmitForm so we can update the form with the zip code in [EMAIL
PROTECTED] #zipSuccess}, but we've
+ * explicitly turned validation off for this action, since the form may be
incomplete.
+ */
+ protected Forward getZip(SubmitForm form)
+ {
+ return new Forward("getZipFlow");
+ }
+
+
+ public static class SubmitForm extends FormData
+ {
+ private String _name;
+ private String _zip;
+
+ @Jpf.ValidatableProperty(
+ displayName="The name",
+ [EMAIL PROTECTED]()
+ )
+ public String getName()
+ {
+ return _name;
+ }
+
+ public void setName(String value)
+ {
+ _name = value;
+ }
+
+ @Jpf.ValidatableProperty(
+ displayName="The zip code",
+ [EMAIL PROTECTED]()
+ )
+ public String getZip()
+ {
+ return _zip;
+ }
+
+ public void setZip(String value)
+ {
+ _zip = value;
+ }
+ }
+
+ /**
+ * For performance reasons, getPreviousFormBean() (used in [EMAIL
PROTECTED] #zipSuccess}) will not
+ * be enabled unless we use <code>@Jpf.NavigateTo.previousAction</code> in
this page flow
+ * flow, <i>or</i> we provide this override. So here we provide the
override.
+ */
+ protected boolean alwaysTrackPreviousAction()
+ {
+ return true;
+ }
+}
+
[EMAIL PROTECTED](value = {
+ "<!-- This data is auto-generated. Hand-editing this section is not
recommended. -->",
+ "<view-properties>",
+ "<pageflow-object
id='pageflow:/miniTests/updateFormFromNested/Controller.jpf'/>",
+ "<pageflow-object id='page:index.jsp'><property name='x'
value='360'/><property name='y' value='100'/></pageflow-object>",
+ "<pageflow-object id='page:results.jsp'><property name='x'
value='480'/><property name='y' value='240'/></pageflow-object>",
+ "<pageflow-object
id='action:submit.do#miniTests.updateFormFromNested.Controller.SubmitForm'><property
name='x' value='480'/><property name='y' value='120'/></pageflow-object>",
+ "<pageflow-object
id='action:getZip.do#miniTests.updateFormFromNested.Controller.SubmitForm'><property
name='x' value='60'/><property name='y' value='40'/></pageflow-object>",
+ "<pageflow-object id='formbean:java.lang.String'/>",
+ "<pageflow-object id='forward:[EMAIL
PROTECTED]:submit.do#miniTests.updateFormFromNested.Controller.SubmitForm@'/>",
+ "<pageflow-object id='return-to:@forward:[EMAIL
PROTECTED]:submit.do#miniTests.updateFormFromNested.Controller.SubmitForm@@'><property
name='x' value='180'/><property name='y' value='160'/></pageflow-object>",
+ "<pageflow-object id='forward:[EMAIL
PROTECTED]:submit.do#miniTests.updateFormFromNested.Controller.SubmitForm@'/>",
+ "<pageflow-object id='external-jpf:getZip/GetZip.jpf'><property name='x'
value='120'/><property name='y' value='100'/></pageflow-object>",
+ "<pageflow-object id='action:zipCancel.do'><property name='x'
value='80'/><property name='y' value='60'/></pageflow-object>",
+ "<pageflow-object id='action-call:@external-jpf:getZip/[EMAIL
PROTECTED]@action:zipCancel.do@'/>",
+ "<pageflow-object id='forward:path#getZipFlow#getZip/[EMAIL
PROTECTED]:getZip.do#miniTests.updateFormFromNested.Controller.SubmitForm@'/>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:submit.do#miniTests.updateFormFromNested.Controller.SubmitForm@'><property
name='elbowsX' value='397,420,420,443'/><property name='elbowsY'
value='92,92,101,101'/><property name='fromPort' value='East_1'/><property
name='toPort' value='West_0'/></pageflow-object>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:getZip.do#miniTests.updateFormFromNested.Controller.SubmitForm@'><property
name='elbowsX' value='323,210,210,97'/><property name='elbowsY'
value='92,92,43,43'/><property name='fromPort' value='West_1'/><property
name='toPort' value='East_2'/></pageflow-object>",
+ "<pageflow-object id='action:begin.do'><property value='80'
name='x'/><property value='100' name='y'/></pageflow-object>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:begin.do@'><property name='elbowsX'
value='443,280,280,117'/><property name='elbowsY'
value='232,232,103,103'/><property name='fromPort' value='West_1'/><property
name='toPort' value='East_2'/></pageflow-object>",
+ "<pageflow-object id='action:zipSuccess.do#java.lang.String'><property
name='x' value='120'/><property name='y' value='320'/></pageflow-object>",
+ "<pageflow-object id='action-call:@external-jpf:getZip/[EMAIL
PROTECTED]@action:zipSuccess.do#java.lang.String@'><property name='elbowsX'
value='120,120,120,120'/><property name='elbowsY'
value='145,210,210,275'/><property name='fromPort' value='South_1'/><property
name='toPort' value='North_1'/></pageflow-object>",
+ "<pageflow-object id='formbean:SubmitForm'/>",
+ "<pageflow-object id='validation-field:[EMAIL PROTECTED]:SubmitForm@'/>",
+ "<pageflow-object id='validation-rule:[EMAIL PROTECTED]:[EMAIL
PROTECTED]:SubmitForm@@'/>",
+ "<pageflow-object id='validation-field:[EMAIL PROTECTED]:SubmitForm@'/>",
+ "<pageflow-object id='validation-rule:[EMAIL PROTECTED]:[EMAIL
PROTECTED]:SubmitForm@@'/>",
+ "<pageflow-object id='return-to:@forward:[EMAIL
PROTECTED]:zipSuccess.do#java.lang.String@@'><property name='x'
value='220'/><property name='y' value='200'/></pageflow-object>",
+ "<pageflow-object id='forward:[EMAIL
PROTECTED]:zipSuccess.do#java.lang.String@'><property name='elbowsX'
value='157,170,170,183'/><property name='elbowsY'
value='312,312,192,192'/><property name='fromPort' value='East_1'/><property
name='toPort' value='West_1'/><property name='label'
value='success'/></pageflow-object>",
+ "</view-properties>"
+})
+interface VIEW_PROPERTIES { }
\ No newline at end of file
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/GetZip.jpf
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/GetZip.jpf?view=auto&rev=124708
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/GetZip.jpf
Sat Jan 8 22:08:48 2005
@@ -0,0 +1,224 @@
+package miniTests.updateFormFromNested.getZip;
+
+import javax.servlet.http.HttpSession;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.struts.action.ActionMapping;
+import org.apache.beehive.netui.pageflow.FormData;
+
+
[EMAIL PROTECTED](
+ nested=true,
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp"),
+ @Jpf.SimpleAction(name="cancel", returnAction="zipCancel")
+ }
+)
+public class GetZip extends PageFlowController
+{
+ /**
+ * This is the zip code that will be returned in [EMAIL PROTECTED] #done}.
+ */
+ private String _zip;
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(
+ name="done",
+ returnAction="zipSuccess",
+ outputFormBeanType=String.class
+ )
+ }
+ )
+ protected Forward done()
+ {
+ return new Forward( "done", _zip );
+ }
+
+
+ @Jpf.Action(
+ forwards={
+ @Jpf.Forward(name="confirm", path="confirm.jsp")
+ },
+ [EMAIL PROTECTED](name="failure",
navigateTo=Jpf.NavigateTo.currentPage)
+ )
+ protected Forward submitZip( ZipForm form )
+ {
+ _zip = form.getZip();
+
+ Forward fwd = new Forward( "confirm" );
+ fwd.addActionOutput( "zip", form.getZip() );
+
+ int prefix = Integer.parseInt( form.getZip().substring( 0, 3 ) );
+ fwd.addActionOutput( "state", _zips[prefix]);
+ return fwd;
+ }
+
+
+ public static class ZipForm extends FormData
+ {
+ private String _zip;
+
+ @Jpf.ValidatableProperty(
+ displayName="The zip code",
+ [EMAIL PROTECTED](),
+ [EMAIL PROTECTED](chars=5),
+ [EMAIL PROTECTED](chars=5),
+ [EMAIL PROTECTED](regex="[0-9][0-9]")
+ )
+ public String getZip()
+ {
+ return _zip;
+ }
+
+ public void setZip(String value)
+ {
+ _zip = value;
+ }
+ }
+
+ private static String[] _zips = new String[1000];
+
+ static
+ {
+ setZips( 5, 5, "New York" );
+ setZips( 6, 7, "Puerto Rico" );
+ setZips( 8, 8, "Virgin Islands" );
+ setZips( 9, 9, "Puerto Rico" );
+ setZips( 10, 27, "Massachusetts" );
+ setZips( 28, 29, "Rhode Island" );
+ setZips( 30, 38, "New Hampshire" );
+ setZips( 39, 49, "Maine" );
+ setZips( 50, 54, "Vermont" );
+ setZips( 55, 55, "Massachusetts" );
+ setZips( 56, 59, "Vermont" );
+ setZips( 60, 69, "Connecticut" );
+ setZips( 70, 89, "New Jersey" );
+ setZips( 90, 99, "Armed Forces Europe*" );
+ setZips( 100, 149, "New York" );
+ setZips( 150, 196, "Pennsylvania" );
+ setZips( 197, 199, "Delaware" );
+ setZips( 200, 200, "District of Columbia" );
+ setZips( 201, 201, "Virginia" );
+ setZips( 202, 205, "District of Columbia" );
+ setZips( 206, 212, "Maryland" );
+ setZips( 214, 219, "Maryland" );
+ setZips( 220, 246, "Virginia" );
+ setZips( 247, 266, "West Virginia" );
+ setZips( 247, 268, "West Virginia" );
+ setZips( 270, 289, "North Carolina" );
+ setZips( 290, 299, "South Carolina" );
+ setZips( 300, 319, "Georgia" );
+ setZips( 320, 339, "Florida" );
+ setZips( 340, 340, "Armed Forces Americas" );
+ setZips( 341, 342, "Florida" );
+ setZips( 344, 344, "Florida" );
+ setZips( 346, 347, "Florida" );
+ setZips( 349, 349, "Florida" );
+ setZips( 350, 352, "Alabama" );
+ setZips( 354, 369, "Alabama" );
+ setZips( 370, 385, "Tennessee" );
+ setZips( 386, 397, "Mississippi" );
+ setZips( 398, 399, "Georgia" );
+ setZips( 399, 399, "Georgia" );
+ setZips( 400, 427, "Kentucky" );
+ setZips( 430, 459, "Ohio" );
+ setZips( 460, 470, "Indiana" );
+ setZips( 471, 471, "Kentucky" );
+ setZips( 472, 479, "Indiana" );
+ setZips( 480, 499, "Michigan" );
+ setZips( 500, 528, "Iowa" );
+ setZips( 530, 532, "Wisconsin" );
+ setZips( 534, 535, "Wisconsin" );
+ setZips( 537, 549, "Wisconsin" );
+ setZips( 550, 551, "Minnesota" );
+ setZips( 553, 566, "Minnesota" );
+ setZips( 567, 567, "North Dakota" );
+ setZips( 570, 577, "South Dakota" );
+ setZips( 580, 588, "North Dakota" );
+ setZips( 590, 599, "Montana" );
+ setZips( 600, 620, "Illinois" );
+ setZips( 622, 629, "Illinois" );
+ setZips( 630, 631, "Missouri" );
+ setZips( 633, 641, "Missouri" );
+ setZips( 644, 658, "Missouri" );
+ setZips( 660, 662, "Kansas" );
+ setZips( 664, 679, "Kansas" );
+ setZips( 680, 681, "Nebraska" );
+ setZips( 683, 693, "Nebraska" );
+ setZips( 700, 701, "Louisiana" );
+ setZips( 703, 708, "Louisiana" );
+ setZips( 710, 714, "Louisiana" );
+ setZips( 716, 729, "Arkansas" );
+ setZips( 730, 731, "Oklahoma" );
+ setZips( 733, 733, "Texas" );
+ setZips( 734, 741, "Oklahoma" );
+ setZips( 743, 749, "Oklahoma" );
+ setZips( 750, 799, "Texas" );
+ setZips( 800, 816, "Colorado" );
+ setZips( 820, 831, "Wyoming" );
+ setZips( 832, 838, "Idaho" );
+ setZips( 840, 847, "Utah" );
+ setZips( 850, 850, "Arizona" );
+ setZips( 852, 853, "Arizona" );
+ setZips( 855, 857, "Arizona" );
+ setZips( 859, 860, "Arizona" );
+ setZips( 863, 865, "Arizona" );
+ setZips( 870, 875, "New Mexico" );
+ setZips( 877, 884, "New Mexico" );
+ setZips( 885, 885, "Texas" );
+ setZips( 889, 891, "Nevada" );
+ setZips( 893, 895, "Nevada" );
+ setZips( 897, 898, "Nevada" );
+ setZips( 900, 908, "California" );
+ setZips( 910, 928, "California" );
+ setZips( 930, 961, "California" );
+ setZips( 962, 966, "Armed Forces Pacific" );
+ setZips( 967, 968, "Hawaii" );
+ setZips( 969, 969, "Guam" );
+ setZips( 970, 979, "Oregon" );
+ setZips( 980, 986, "Washington" );
+ setZips( 988, 994, "Washington" );
+ setZips( 995, 999, "Alaska" );
+ }
+
+ private static void setZips( int start, int end, String state )
+ {
+ for ( int i = start; i <= end; ++i )
+ {
+ _zips[i] = state;
+ }
+ }
+}
+
[EMAIL PROTECTED](value = {
+ "<!-- This data is auto-generated. Hand-editing this section is not
recommended. -->",
+ "<view-properties>",
+ "<pageflow-object
id='pageflow:/miniTests/updateFormFromNested/getZip/GetZip.jpf'/>",
+ "<pageflow-object id='page:confirm.jsp'><property name='x'
value='460'/><property name='y' value='80'/></pageflow-object>",
+ "<pageflow-object id='page:index.jsp'><property name='x'
value='620'/><property name='y' value='240'/></pageflow-object>",
+ "<pageflow-object id='formbean:ZipForm'/>",
+ "<pageflow-object id='validation-field:[EMAIL PROTECTED]:ZipForm@'/>",
+ "<pageflow-object id='validation-rule:[EMAIL PROTECTED]:[EMAIL
PROTECTED]:ZipForm@@'/>",
+ "<pageflow-object id='validation-rule:[EMAIL PROTECTED]:[EMAIL
PROTECTED]:ZipForm@@'/>",
+ "<pageflow-object id='validation-rule:[EMAIL PROTECTED]:[EMAIL
PROTECTED]:ZipForm@@'/>",
+ "<pageflow-object id='validation-rule:[EMAIL PROTECTED]:[EMAIL
PROTECTED]:ZipForm@@'/>",
+ "<pageflow-object id='action:done.do'><property value='440'
name='x'/><property value='340' name='y'/></pageflow-object>",
+ "<pageflow-object
id='action:submitZip.do#miniTests.updateFormFromNested.getZip.GetZip.ZipForm'><property
name='x' value='620'/><property name='y' value='80'/></pageflow-object>",
+ "<pageflow-object id='exit:zipSuccess'><property name='x'
value='440'/><property name='y' value='460'/></pageflow-object>",
+ "<pageflow-object id='forward:[EMAIL PROTECTED]:done.do@'/>",
+ "<pageflow-object id='forward:[EMAIL
PROTECTED]:submitZip.do#miniTests.updateFormFromNested.getZip.GetZip.ZipForm@'><property
name='elbowsX' value='583,575,575,497'/><property name='elbowsY'
value='61,61,72,72'/><property name='fromPort' value='West_0'/><property
name='toPort' value='East_1'/><property name='label'
value='confirm'/></pageflow-object>",
+ "<pageflow-object id='return-to:@forward:[EMAIL
PROTECTED]:submitZip.do#miniTests.updateFormFromNested.getZip.GetZip.ZipForm@@'><property
name='x' value='960'/><property name='y' value='80'/></pageflow-object>",
+ "<pageflow-object id='forward:[EMAIL
PROTECTED]:submitZip.do#miniTests.updateFormFromNested.getZip.GetZip.ZipForm@'><property
name='elbowsX' value='657,657,657,923'/><property name='elbowsY'
value='72,72,72,72'/><property name='fromPort' value='East_1'/><property
name='toPort' value='West_1'/><property name='label'
value='failure'/></pageflow-object>",
+ "<pageflow-object
id='exit:miniTests_updateFormFromNested_getZipDone'><property value='160'
name='x'/><property value='360' name='y'/></pageflow-object>",
+ "<pageflow-object id='action:begin.do'><property value='100'
name='x'/><property value='100' name='y'/></pageflow-object>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:done.do@'><property name='elbowsX'
value='460,460,440,440'/><property name='elbowsY'
value='125,125,125,295'/><property name='fromPort' value='South_1'/><property
name='toPort' value='North_1'/></pageflow-object>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:begin.do@'><property name='elbowsX'
value='423,415,415,195,195,137'/><property name='elbowsY'
value='61,61,105,105,92,92'/><property name='fromPort'
value='West_0'/><property name='toPort' value='East_1'/></pageflow-object>",
+ "<pageflow-object id='action:cancel.do'><property name='x'
value='620'/><property name='y' value='360'/></pageflow-object>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:submitZip.do#miniTests.updateFormFromNested.getZip.GetZip.ZipForm@'><property
name='elbowsX' value='620,620,620,620'/><property name='elbowsY'
value='195,195,195,125'/><property name='fromPort' value='North_1'/><property
name='toPort' value='South_1'/></pageflow-object>",
+ "<pageflow-object id='action-call:@page:[EMAIL
PROTECTED]@action:cancel.do@'><property name='elbowsX'
value='620,620,620,620'/><property name='elbowsY'
value='285,300,300,315'/><property name='fromPort' value='South_1'/><property
name='toPort' value='North_1'/></pageflow-object>",
+ "</view-properties>"
+})
+interface VIEW_PROPERTIES { }
\ No newline at end of file
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/confirm.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/confirm.jsp?view=auto&rev=124708
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/confirm.jsp
Sat Jan 8 22:08:48 2005
@@ -0,0 +1,16 @@
+<[EMAIL PROTECTED] contentType="text/html;charset=UTF-8" language="java"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<html>
+ <head>
+ </head>
+ <body>
+ You have chosen <b>${pageInput.zip}</b>, in <b>${pageInput.state}</b>.
+ Is this correct?
+ <br/>
+ <br/>
+ <netui:form action="done">
+ <netui:button value="yes"/>
+ <netui:button action="begin" value="no"/>
+ </netui:form>
+ </body>
+</html>
\ No newline at end of file
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/index.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/index.jsp?view=auto&rev=124708
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/getZip/index.jsp
Sat Jan 8 22:08:48 2005
@@ -0,0 +1,30 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <netui:form action="submitZip">
+ <table>
+ <tr valign="top">
+ <td>Zip:</td>
+ <td>
+ <netui:textBox dataSource="actionForm.zip"></netui:textBox>
+ <span style="color:red"><netui:error value="zip"/></span>
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <netui:button type="submit" value="submit"/>
+ <netui:button type="submit" action="cancel" value="cancel"/>
+ </netui:form>
+
+ </netui:body>
+</netui:html>
+
+
\ No newline at end of file
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/index.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/index.jsp?view=auto&rev=124708
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/index.jsp
Sat Jan 8 22:08:48 2005
@@ -0,0 +1,37 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ <netui:form action="submit">
+ <table>
+ <tr valign="top">
+ <td>Name:</td>
+ <td>
+ <netui:textBox dataSource="actionForm.name"></netui:textBox>
+ <span style="color:red"><netui:error value="name"/></span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>Zip:</td>
+ <td>
+ <netui:textBox dataSource="actionForm.zip"></netui:textBox>
+ <span style="color:red"><netui:error value="zip"/></span>
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <netui:button type="submit" value="get zip" action="getZip"/>
+ <netui:button type="submit" value="submit"/>
+ </netui:form>
+
+ </netui:body>
+</netui:html>
+
+
\ No newline at end of file
Added:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/results.jsp
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/results.jsp?view=auto&rev=124708
==============================================================================
--- (empty file)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/results.jsp
Sat Jan 8 22:08:48 2005
@@ -0,0 +1,21 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%>
+<%@ taglib prefix="netui-data"
uri="http://beehive.apache.org/netui/tags-databinding-1.0"%>
+<%@ taglib prefix="netui-template"
uri="http://beehive.apache.org/netui/tags-template-1.0"%>
+
+
+<netui:html>
+ <head>
+ <netui:base/>
+ </head>
+ <netui:body>
+ name is: ${pageInput.form.name}
+ <br/>
+ zip is: ${pageInput.form.zip}
+ <br/>
+ <br/>
+ <netui:anchor action="begin">start over</netui:anchor>
+ </netui:body>
+</netui:html>
+
+
\ No newline at end of file
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Url:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=124708&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=124707&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=124708
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
Sat Jan 8 22:08:48 2005
@@ -5741,6 +5741,21 @@
</features>
</test>
<test>
+ <name>UpdateFormFromNested</name>
+ <description>Test of updating a form with values obtained from a
nested page flow.</description>
+ <webapp>coreWeb</webapp>
+ <categories>
+ <category>bvt</category>
+ <category>bvt.struts11</category>
+ <category>corePageFlow</category>
+ </categories>
+ <features>
+ <feature>PageFlow</feature>
+ <feature>Nesting</feature>
+ <feature>Form</feature>
+ </features>
+ </test>
+ <test>
<name>UrlBinding</name>
<description>Test of binding to the {url} context.</description>
<webapp>coreWeb</webapp>