You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Phase Web and Multimedia <ma...@phase.ws> on 2002/04/04 06:08:07 UTC

DynaActionForm Examples

Are there any good examples of the DynaActionForm? I looked at the
struts-example login. I am not sure I see the advantage over creating an
ActionForm class apart from a little time savings. I thought the
DynaActionForm could be extended like the regular ActionForm so that I can
mix get/set methods (hard coded) with dynamic properties, that are
configured in the struts-config, then gathered and placed into a scope for
use in the view. Am I off base? Someone has to have some real code out
there. An official explanation of the DynaAction stuff would be nice. I know
developers are swamped. But, if someones using it... post your code or let
us know what you are doin with it.

Thanks,
Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Beta 1 bugs in struts-exercise-taglib examples

Posted by Jing Zhou <ji...@netspread.com>.
There are two possible bugs related to the exampe pages index.jsp and
html-link.jsp
in the struts-exercise-taglib in struts beta 1 release.

The first one appeard in 04/03 nightly build. When clicking the link in the
index.jsp
that is pointing to the html-link.jsp, an exception is thrown for a reason
message resources not found under key org.apache.struts.action.MESSAG.

A quick fix I think is to change the BaseHandlerTag.message(String literal,
String key).
When both literal and key are null, this method should return null. Right
now it will
go ahead to invoke RequestUtils method and throw exception there.

The second bug appeared since 03/19, the formal b1 release. When clicking
the
'Cancel' button on the html-link.jsp, an exception is thrown for 'array
element type mismatch'
in PropertyUtils.setIndexedProperty(...).


The exception is thrown because the TestBean has no indexed method for
stringArray
while the PropertyUtils is invoking setIndexedProperty when it sees the
stringArray[0]
as the property name. A quick fix I could think right now is to change the
BeanUtils.populate
method around the section '// Conver the parameter value as required for
this setter method'

Origianl section:
    if(parameterTypes.length > 1)
        parameterType = parameterTypes[1];   // Indexed or mapped setter

Change to:
     if(parameterTypes.length > 1) {
          parameterType = parameterTypes[1]; // Indexed or mapped setter
     } else {
          int nestedDel = name.lastIndexOf(PropertyUtils.NESTED_DELIM);
          int indexedDel = name.lastIndexOf(PropertyUtils.INDEXED_DELIM);
          if(indexedDel > nestedDel) {
               // PropertyUtils will invoke setIndexedProperty later, but
actually the method is not indexed
                if(parameterType.isArray()) {
                    parameterType = parameterType.getComponentType();
                 }
           }
      }

The way of the fix is not optimized, it just fixes the problem shown in the
html-link.jsp.
I just started to look at the beta 1 codes and may overlooked other aspects
of the overall architecture.
Let me know if anyone finds the same exceptions or they are addressed
somehow in another way.

Thanks,
Jing


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>