You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2005/11/24 22:07:15 UTC
[struts-faces] html:form vs. s:form
I have code for populating form beans dynamically, as follows (I'll
spare you the dirty details of why I'm doing this instead of relying on
Struts' standard form bean population):
String formKey = Constants.FORM_KEY;
getJspContext().findAttribute(formKey);
String formBeanName = formTag.getBeanName();
ActionForm form = (ActionForm) getJspContext().
findAttribute(formBeanName);
BeanUtils.copyProperties(form, source);
Using s:form from the struts-face lib, this fails as (a) there's no
instance of the form tag stored in any scope under that key; and (b)
even if it were, the tag implementation class isn't type compatible with
the standard Struts tag.
So, the first question is should this be considered a bug in so much as
s:form is documented as being functionally equivalent to html:form?
And second, how would I rewrite the above code so it works equivalently
with both form tags?
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [struts-faces] html:form vs. s:form
Posted by Laurie Harper <la...@holoweb.net>.
Craig McClanahan wrote:
> On 11/24/05, Laurie Harper <la...@holoweb.net> wrote:
>> I have code for populating form beans dynamically, as follows (I'll
>> spare you the dirty details of why I'm doing this instead of relying on
>> Struts' standard form bean population):
>>
>> String formKey = Constants.FORM_KEY;
>> getJspContext().findAttribute(formKey);
>> String formBeanName = formTag.getBeanName();
>> ActionForm form = (ActionForm) getJspContext().
>> findAttribute(formBeanName);
>> BeanUtils.copyProperties(form, source);
>>
>> Using s:form from the struts-face lib, this fails as (a) there's no
>> instance of the form tag stored in any scope under that key; and (b)
>> even if it were, the tag implementation class isn't type compatible with
>> the standard Struts tag.
>
> So, the first question is should this be considered a bug in so much as
>> s:form is documented as being functionally equivalent to html:form?
>
> Yah, that sounds like a bug ... or perhaps a change in functionality of the
> standard version that needs to be ported to the faces version.
OK, I'll file something for that once I understand what the correct
behaviour should be.
> And second, how would I rewrite the above code so it works equivalently
>> with both form tags?
>
> This one will have to wait until tomorrow ... getting ready to go join the
> rest of my family and gorge on a bit of turkey :-).
>
> Happy Thanksgiving!
Fair enough ;-) Enjoy the turkey!
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [struts-faces] html:form vs. s:form
Posted by Craig McClanahan <cr...@apache.org>.
On 11/24/05, Laurie Harper <la...@holoweb.net> wrote:
>
> I have code for populating form beans dynamically, as follows (I'll
> spare you the dirty details of why I'm doing this instead of relying on
> Struts' standard form bean population):
>
> String formKey = Constants.FORM_KEY;
> getJspContext().findAttribute(formKey);
> String formBeanName = formTag.getBeanName();
> ActionForm form = (ActionForm) getJspContext().
> findAttribute(formBeanName);
> BeanUtils.copyProperties(form, source);
>
> Using s:form from the struts-face lib, this fails as (a) there's no
> instance of the form tag stored in any scope under that key; and (b)
> even if it were, the tag implementation class isn't type compatible with
> the standard Struts tag.
So, the first question is should this be considered a bug in so much as
> s:form is documented as being functionally equivalent to html:form?
Yah, that sounds like a bug ... or perhaps a change in functionality of the
standard version that needs to be ported to the faces version.
And second, how would I rewrite the above code so it works equivalently
> with both form tags?
This one will have to wait until tomorrow ... getting ready to go join the
rest of my family and gorge on a bit of turkey :-).
Happy Thanksgiving!
L.
Craig
---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>