I need your help in something similar to what you are doing.
candidateVO.address.state.code sets and gets the code. how are you exactly 
setting/getting the values for "code". I have something like this:-
activity.location[i].hrs[i] which needs to be displayed as text boxes and 
the value passed (after error checks) gets into "hrs" and passed into the 
database.

>From: "David Boardman" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: "Struts" <[EMAIL PROTECTED]>
>Subject: deep nesting of value objects in a form bean
>Date: Mon, 1 Oct 2001 18:39:23 -0500
>
>I am looking for some confirmation of the approach I have taken in
>developing an ActionForm that represents an Entity bean hierarchy that 
>nests
>several beans deep.
>
>I have a form bean that I use to update a Candidate entity bean.  The
>Candidate bean has an Address entity bean associated with it, and the
>Address bean contains both a Country entity bean and a State entity bean.  
>I
>have created ValueObjects for each of these entity beans so that, for
>instance, I can call CandidateVO.getAddress().getState().getCode() to
>retrieve the state code.  With the ValueObjects nested in this way I can
>simply call the setCandidateVO() on the ActionForm and use nested 
>properties
>in my jsp to interact with the ActionForm.  For instance, if the following
>field were in the jsp, then
>getCandidateVO().getAddress().getState().setCode() would be called when the
>form is submitted:
>
><html:text property="candidateVO.address.state.code" size="2"
>maxlength="2"/>
>
>I have then planned on writting updateVO() methods on each of the entity
>beans that would be used to update the beans from the newly updated
>ValueObjects.
>
>I have 2 questions about this scenario:
>
>1)From what I ahve read, ValueObjects are supposed to be immutable, 
>however,
>in the scenario above they clearly are not.  Is there a way to accomplish
>the above scenario without making the ValueObjects mutable.
>
>2)If one of the attributes of one of my entity beans is not a String, is
>there still a way to use nested properties to set that attribute?  Or do I
>need to create a method that does the type conversion in the ActionForm, 
>and
>then populate the ValueObject back in my Action class?
>
>thanks,
>
>Dave
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Reply via email to