Seems to me this logic belongs in your Action class or better still in you Business
Logic class.
In action class code like:-
yourFormBean.setName(BusinessClass.getUsersPreferredDefaultDeviceName(userPreferenceStyle));
.
The form bean is supposed to be for transferring data between the form & your action
class, not
for deciding what the values should be. (I think some people actually generate form
beans
automatically from the struts form HTML).
Keith.
--- Alex Paransky <[EMAIL PROTECTED]> wrote:
> I have a bean on a page which does not have the same structure as a form in
> terms of fields and names of those fields. However, I want to use values
> from that bean to "DEFAULT" my form values to. How can I do this without
> resorting to scriplet mode?
>
> In other words the bean looks like this:
>
> public class SomeBean {
> public String getDeviceName() {...
> }
>
> The form looks like this:
>
> public class SomeOtherForm extends ActionForm {
> public void setName(String name) {...
> }
>
> As you can see, the names in the form, do not match with the bean. When I
> layout the <html:text ... I would like the value to default to
> someBean.getDeviceName(), but I want it to be written using
> someOtherForm.setName(...). Using <html:form property= assumes that the
> property defines source and destination.
>
> I guess, I could "combine" the functionality of SomeBean with SomeOtherForm,
> and use SomeOtherForm instead of SomeBean. But there are cases when
> SomeBean is used just to get the values and display them on the page outside
> of forms. In other words, SomeBean is used to get the data from the
> datasource. There could be many more members in SomeBean then in the form.
>
> I could duplicate the partial logic in SomeOtherForm to do similar stuff
> that SomeBean is doing, but that would be duplication of code. I already
> have SomeBean which retrieves data for me.
>
> Am I missing something?
>
> Thanks.
>
> -AP_
> www: http://www.alexparansky.com
>
> PS: If this question has been answered already, could someone please kindly
> point me to where I can search the archive for older messages?
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>