check out
http://jakarta.apache.org/struts/userGuide/struts-html.html#options
(I wouldnt use collection in this case..I assume we are returning scalar
entity)
to paraphrase
"where collection of values actually selected depends on the presence or
absence of the name and property attributes"
the name or property being null can be tested and value assigned can be
ascertained.
Keep me informed,
-Martin
----- Original Message -----
From: "Marc Dugger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 18, 2003 12:35 PM
Subject: populating form fields from request params
> I am using the same form to both create and update database entities. The
> following is an example of a form field:
>
> <html-el:select property='documentStatusTypeId'
> value='${note.auditIdentity.documentStatusType.id}'
> onchange="editNoteForm.action=''; editNoteForm.submit(); return true;">
> <html:options collection='<%=ContextKey.DOCUMENT_STATUS_TYPES%>'
> property='id' labelProperty='name' />
> </html-el:select>
>
> And from my struts-config.xml:
>
> <form-bean name="editNoteForm"
> type="org.apache.struts.validator.DynaValidatorForm" dynamic="true">
> <form-property name="noteId" type="java.lang.Integer" />
> <form-property name="documentStatusTypeId"
> type="java.lang.Integer" />
> ... yada, yada, yada ...
> </form-bean>
>
> As you can see, if this field changes the page is reloaded. Problem: if
> ${note.auditIdentity} returns null (which would be the case if I was
> creating a new entity) the property is not being populated from form bean.
> How do I specify that if value is <null>, populate from form bean's
> property?
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]