You input field will be something like

<html:text name="myForm" property="address.line1"/>

Or if you only want to display
<bean:write name="myForm" property="address.line1"/>

This assumes you have a form called myForm with your address object called
getAddress() and your address object has getLine1().

-----Original Message-----
From: Wendy Krehbiel [mailto:[EMAIL PROTECTED]]
Sent: 18 November, 2002 08:27
To: [EMAIL PROTECTED]
Subject: Question about object in struts form


Hello,
I'm new to struts and have tried looking through the
archives here as well as around the web and am unable
to find the answer to my question.  I'm guessing that
it's not possible to do what I want, but figured I'd
ask before giving up...

So, I have a class User that contains a String for
the name, and an Address object for the address (the
Address object contains more Strings, etc for city,
state, zip, address1, etc).  I have defined all the
get/set functions.

I have a form that I want to use to edit the user
info.  No problem to edit the name.  Problem is that
I also want to edit the address fields.  

So, what I was hoping to be able to do was declare
my dyna-form in struts-config to have a form-property
with name="user" and type="org.blah.blah.dao.User". 
Then in the jsp code I would refer to user.name,
user.address.city, etc.  I got this to work fine for
creating and populating the edit page.  The problem
comes about when I try to "save" the changes.  No
matter what I try I get all kinds of errors in the
BeanUtils populate.  

One that I can't seem to get around is that it seems
to want me to have a hidden type for my user object,
and when I do that it complains that it can't conver
from type String to type User.  

The other weird thing is that in the logs it gives
me the following: 
[Thread-4] DEBUG org.apache.struts.util.RequestUtils

-  -->
DynaActionForm[dynaClass=userForm,user=org.taprootfoundation.trweb.dao.User@
181497d]
[Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  - Storing
ActionForm bean instance in scope 'session' under
attribute key 'userForm'
[Thread-4] DEBUG
org.apache.struts.action.RequestProcessor  -
Populating bean properties from this request 
[Thread-4] DEBUG
org.apache.commons.beanutils.BeanUtils  -
BeanUtils.populate(DynaActionForm[dynaClass=userForm,user=<NULL>]

I don't understand why it has a value for user within
the userForm, and then seems to "lose" it.  Before I
made my scope session (was request before), it had
NULL throughout the logs.

Any suggestions, or examples, or statements that you
can't do what I'm trying to do are appreciated.

Thanks,
Wendy
[EMAIL PROTECTED]


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

______________________________________________

Disclaimer and confidentiality note


Everything in this e-mail and any attachments relating to the official business of 
Standard Bank Group Limited is proprietary to the company. It is confidential, legally 
privileged and protected by law. Standard Bank does not own and endorse any other 
content. 
Views and opinions are those of the sender unless clearly stated as being that of 
Standard Bank. 

The person addressed in the e-mail is the sole authorised recipient. Please notify the 
sender 
immediately if it has unintentionally reached you and do not read, disclose or use the 
content
in any way. 

Standard Bank can not assure that the integrity of this communication has been 
maintained nor 
that it is free of errors, virus, interception or interference.

______________________________________________

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to