Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
zoning out on some basic LazyDynaMap usage for a text field property?

zoning out on some basic LazyDynaMap usage for a text field property?

2007-12-02       - By Martin Gainty

 Back
Reply:     1     2     3     4     5  

http://struts.apache.org/1.2.7/api/org/apache/struts/action/DynaActionForm.h
tml#initialize(org.apache.struts.action.ActionMapping)
quote
Since Struts 1.1, the reset method no longer initializes property values to
those specified in <form-property> elements in the Struts module
configuration file. If you wish to utilize that behavior, the simplest
solution is to subclass DynaActionForm and call the initialize method inside
it.

1)setup FormBeanConfig supplying name and type
http://struts.apache.org/1.2.7/api/org/apache/struts/config/FormBeanConfig.h
tml
beanconfig.setName("name");
and then beanConfig.setType("org.apache.struts.action.DynaActionForm");

2)// Construct a corresponding DynaActionFormClass
http://struts.apache.org/1.2.7/api/org/apache/struts/action/DynaActionFormCl
ass.html
       dynaClass = new DynaActionFormClass(beanConfig);
constructing the DynaActionForm for FormBeanConfig class

3)2 ways to initialize DynaActionForm
Initialize your DynaActionForm is with FormBeanConfig if you have a
<form-bean>
of struts-config file
http://struts.apache.org/1.2.7/api/org/apache/struts/action/DynaActionForm.h
tml#initialize(org.apache.struts.config.FormBeanConfig)

the other initialize method assumes you are initializing properties from
<form-property> of struts-config file
http://struts.apache.org/1.2.7/api/org/apache/struts/action/ActionMapping.ht
ml

complete example located at
/src/test/org/apache/struts/action/TestDynaActionFormClass.java

M--
-- -- Original Message -- --
From: "Vinny" <xaymaca@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Friday, November 30, 2007 8:57 PM
Subject: Re: zoning out on some basic LazyDynaMap usage for a text field
property?


> Hmm,
> I've never tried using lazy inside a standard ActionForm, the ones that I
> have work inside of
> a DynaValidatorActionFom (say that 3 times fast). Don't feel like writing
a
> reset method? you are
> getting old Rick.
>
> On Nov 30, 2007 7:17 PM, Rick Reumann <rick.reumann@(protected)> wrote:
>
> > I swore I used to be able to do this stuff... maybe it's Friday thing,
but
> > regardless I'm blanking on out on what I'm doing wrong with this...
> >
> > I have an ActionForm that has one property right now:
> >   private LazyDynaBean dynaBean = new LazyDynaMap();
> >
> > My goal is to be able to populate this DynaBean with any level of nested
> > DynaMaps and have everything populate correctly using Request scope on
my
> > form. (Not shown here but an 'answer' as a map value can end up being
> > another Map and so on - nested to any level.)
> >
> > I'm currently having trouble defining the property name correctly. Here
is
> > a
> > summary
> >
> > Not working:
> > <html:text name="myForm" property="dynaBean.map
> > (question_1).map(answerString)"/>
> >
> > Error:
> > Invalid argument looking up property:
> > "dynaBean.map(question_1).map(answerString)"
> > of bean: "myForm"
> >
> > Working fine:
> > <c:out value="${myForm.dynaBean.map['question_1'].map['answerString']}/>
> >
> >
> > I'm populating in my Action before the form as:
> >
> > //create some questions
> > MyForm mForm = (MyForm)form;
> > LazyDynaBean dynaBean1 = mForm.getDynaBean();
> > Map map1 = dynaBean1.getMap();
> >
> > LazyDynaMap questionAnswer = new LazyDynaMap();
> > questionAnswer.set("questionText", "Pet's name:");
> > questionAnswer.set("answerString", "Fido");
> > map1.put("question_1", questionAnswer);
> >
> >
> > I've tried a few different ways defining the text field property all
with
> > no
> > luck at the moment. What am I doing wrong? (I know I could also use a
> > DynaActionForm defined in my struts-config, but this should work as well
> > with a DynaBean in a standard ActionForm. I typically don't like using
> > DynaActionForm because I end up usually having to create a reset method
> > anyway so once I do that I might as well code the properties in that
> > concrete class.)
> >
> > --
> > Rick
> >
>
>
>
> --
> The Street Programmer http://streetprogrammer.com
>


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.