You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "A. Alonso Dominguez" <al...@gmail.com> on 2006/05/11 18:34:42 UTC

Form component's name attribute do not correspond to expected request parameter

Hi there,

I'm posting this message because I'm begining to test the new Struts-Action
1 snapshot releases, specifically the new Struts-Faces project and MyFaces
1.1.2.

Then, when I tried to submit a struts based form bean I found out that the
request parameters wasn't populated to ActionForm instance.

Taking a look to the HTML code generated from the renderers, I found that
the 'name' attribute of my input fields are being rendered as
'body:logonForm:username', exactly same value as the 'id' attribute.

I know that this problem appears since myFaces 1.0.9, take a look to the
following issue:
http://issues.apache.org/struts/browse/STR-2856

I this really intended?, I couldn't see any issue posted on MyFaces JIRA
about this so I'm a bit confused.

Is this a problem of Struts-Faces or MyFaces???

Any help on this will be appreciated..

Regards,
Alonso

Re: Form component's name attribute do not correspond to expected request parameter

Posted by "A. Alonso Dominguez" <al...@gmail.com>.
Hi Craig,

I didn't see that any of struts-faces examples apps where using that kind of
configuration: (struts-action 1.3.4), there is a fragment from example #1

<managed-bean>
    <managed-bean-name>indexBacking</managed-bean-name>
    <managed-bean-class>
      org.apache.struts.webapp.example.IndexBacking
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>


  <!-- Backing Bean for mainMenu.jsp -->
  <managed-bean>
    <managed-bean-name>mainMenuBacking</managed-bean-name>
    <managed-bean-class>
      org.apache.struts.webapp.example.MainMenuBacking
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>


  <!-- Backing Bean for registration.jsp -->
  <managed-bean>
    <managed-bean-name>registrationBacking</managed-bean-name>
    <managed-bean-class>
      org.apache.struts.webapp.example.RegistrationBacking
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>

  <!-- Navigation Rules for index.jsp -->
  <navigation-rule>
    <from-view-id>/index.jsp</from-view-id>
    <navigation-case>
      <from-outcome>logon</from-outcome>
      <to-view-id>/logon.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>

There is not any ActionForm configured as a ManagedBean and the Action
classes make use of the ActionForm instead of using ManagedBeans.

And what about that issue: http://issues.apache.org/struts/browse/STR-2856

Alonso

2006/5/11, Craig McClanahan <cr...@apache.org>:
>
> On 5/11/06, A. Alonso Dominguez <al...@gmail.com> wrote:
>
> > Hi there,
> >
> > I'm posting this message because I'm begining to test the new
> > Struts-Action 1 snapshot releases, specifically the new Struts-Faces
> > project and MyFaces 1.1.2.
> >
> > Then, when I tried to submit a struts based form bean I found out that
> > the request parameters wasn't populated to ActionForm instance.
> >
> > Taking a look to the HTML code generated from the renderers, I found
> > that the 'name' attribute of my input fields are being rendered as
> > 'body:logonForm:username', exactly same value as the 'id' attribute.
> >
> > I know that this problem appears since myFaces 1.0.9, take a look to the
> > following issue:
> > http://issues.apache.org/struts/browse/STR-2856
> >
> > I this really intended?, I couldn't see any issue posted on MyFaces JIRA
> > about this so I'm a bit confused.
> >
> > Is this a problem of Struts-Faces or MyFaces???
> >
>
> If you are planning on using the Struts-Faces integration library, then
> you should do form bean population the "JSF way" instead of the "Struts
> way".  In other words, declare your ActionForm bean to be a managed bean in
> faces-config.xml, and then use value binding expressions in the input
> components inside your page to bind to the property values of this form
> bean.  It's also quite convenent to use the same bean for your actions as
> well ... the "Struts-Faces Example Application #1" example app shows you how
> to do this.  It's the good old "Struts MailReader" example, converted to use
> JSF techniques.
>
> Any help on this will be appreciated..
> >
> > Regards,
> > Alonso
> >
>
> Craig
>
>

Re: Form component's name attribute do not correspond to expected request parameter

Posted by Craig McClanahan <cr...@apache.org>.
On 5/11/06, A. Alonso Dominguez <al...@gmail.com> wrote:
>
> Hi there,
>
> I'm posting this message because I'm begining to test the new
> Struts-Action 1 snapshot releases, specifically the new Struts-Faces
> project and MyFaces 1.1.2.
>
> Then, when I tried to submit a struts based form bean I found out that the
> request parameters wasn't populated to ActionForm instance.
>
> Taking a look to the HTML code generated from the renderers, I found that
> the 'name' attribute of my input fields are being rendered as
> 'body:logonForm:username', exactly same value as the 'id' attribute.
>
> I know that this problem appears since myFaces 1.0.9, take a look to the
> following issue:
> http://issues.apache.org/struts/browse/STR-2856
>
> I this really intended?, I couldn't see any issue posted on MyFaces JIRA
> about this so I'm a bit confused.
>
> Is this a problem of Struts-Faces or MyFaces???
>

If you are planning on using the Struts-Faces integration library, then you
should do form bean population the "JSF way" instead of the "Struts way".
In other words, declare your ActionForm bean to be a managed bean in
faces-config.xml, and then use value binding expressions in the input
components inside your page to bind to the property values of this form
bean.  It's also quite convenent to use the same bean for your actions as
well ... the "Struts-Faces Example Application #1" example app shows you how
to do this.  It's the good old "Struts MailReader" example, converted to use
JSF techniques.

Any help on this will be appreciated..
>
> Regards,
> Alonso
>

Craig