You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yanroy <rm...@wpi.edu> on 2006/07/11 18:38:44 UTC

how do I use a LazyDynaBean as an ActionForm?

Hi,
You may recall I posted a message similar to this one several days ago.  I
never received a reply, so I'm hoping that this shorter (and hopefully
simpler) version will get one.  I'm using a LazyDynaBean as the form
associated with a strut, which the docs seem to say will work by being
wrapped inside some other kind of ActionForm.  I haven't found any examples
online of exactly how to do this (none contain struts-config.xml, strut and
JSP all from the same app).  I'll give you a couple lines from my
struts-config.xml:

<form-bean 
	name="AnalysisForm" 
	type="org.apache.commons.beanutils.LazyDynaBean">
	<form-property 
		name="runnableTables" 
		type="java.lang.Integer"
		initial="1" 
		/>
</form-bean>

I also specify some array fields in that bean, but I edited that out for the
sake of brevity.

I also have my action:

<action
			path="/AnalysisConfig"
			name="AnalysisForm"
			type="org.assistment.apps.newReporting.analysis.struts.AnalysisConfig"
			scope="request"
			parameter="method">
</action>

The real problem here is that I have no idea how to get the data out of the
LazyDynaBean.  In my action strut, the form parameter passed to the handler
is null.  To me, this indicates some kind of misconfiguration, but I can't
see what it could be.  I'd greatly appreciate any help you can give... this
problem is completely holding up my work (it's the last part of the webapp
I'm making).

Thank you very much,
Ryan

PS - If anyone cares, my previous message was titled "ActionForm is null
when using dynabean"
-- 
View this message in context: http://www.nabble.com/how-do-I-use-a-LazyDynaBean-as-an-ActionForm--tf1925661.html#a5273110
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: how do I use a LazyDynaBean as an ActionForm?

Posted by Yanroy <rm...@wpi.edu>.
It's exactly the "lazy" part of the functionality that I need.  I have a
large and arbitrary (because they can be defined by the user) set of classes
that need fields populated inside them to configure them.  I'm assembling
the forms to get the user input based on the heirarchy of the class - they
all extend StatisticalAnalysis, so I include the .jsp fragment that presents
form fields for configuring that class's members, and then many of them also
extend FilteredAnalysis, so I intelligiently include or don't include the
jsp fragment for that, etc.  There's no way I can hope to keep the
struts-config.xml up to date with all the fields and potentially massive
number of different forms (also, by assembling the forms from fragments,
it's helpful for them to all use the same form name/type).

During the interim between my last post and your reply, I found a
LazyDynaActionForm implementation at
http://wiki.apache.org/struts/StrutsCatalogLazyList, which I came across
while searching for an answer to the exception I mentioned in my last post. 
Unfortunately, when using that, I get a "javax.servlet.jsp.JspException: No
getter method available for property filterField for bean under name
org.apache.struts.taglib.html.BEAN".  I'll ask around the lab about the
commons-validator thing... I'm not in charge of the libraries that get
distributed to the developers; if I can get that resolved, maybe I won't
have to deal with this new class.

Thanks very much for your help,
Ryan
-- 
View this message in context: http://www.nabble.com/how-do-I-use-a-LazyDynaBean-as-an-ActionForm--tf1925661.html#a5275174
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: how do I use a LazyDynaBean as an ActionForm?

Posted by Yanroy <rm...@wpi.edu>.
I've seen the LazyValidatorForm referenced on a number of websites.  I
actually tried it before I tried the LazyDynaBean, but it causes an
exception.  Apparently there's some related class missing?  Here's what I
get from tomcat when I try to use it:

java.lang.NoClassDefFoundError:
org/apache/commons/validator/ValidatorException

The rest of the stack trace seems to indicate it's coming from a JSP,
presumably the one my strut forwards to.  My understanding of
LazyValidatorForm is that it is now a full part of struts, so I assume it's
in the struts libs, which are definately installed.  I'm obviously missing
something here...  Do I need to enable the validator?  I was planning on
doing validation myself inside the strut.

Thanks again,
Ryan
-- 
View this message in context: http://www.nabble.com/how-do-I-use-a-LazyDynaBean-as-an-ActionForm--tf1925661.html#a5274452
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org