QeelwaEtech / omnifaces

Automatically exported from code.google.com/p/omnifaces
0 stars 1 forks source link

o:form, having same f:metadata->viewParam more than once causes <o:form includeViewParams="true"> to have this param more than once, too. #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I am using <o:form> to have support for my HTTP-GET-urls in jsf-forms.

In my jsf, I have defined:
<f:metadata>
    <f:viewParam name="companyId" value="#{companyBean.companyId}" />
    ...
    <f:viewParam name="companyId" value="#{addressBean.companyId}" />
    ...
</f:metadata>

Because of this, I get o:form action-urls like 
"/company/data.xhtml?companyId=2&companyId=2"

When removing one of the f:metadata->viewParams, the o:form action-url is as 
expected, containing "companyId" only once.

Greetz,
Markus Schulte

Omnifaces 1.3

Original issue reported on code.google.com by markussc...@gmail.com on 12 Feb 2013 at 8:56

GoogleCodeExporter commented 9 years ago

Original comment by balusc on 12 Feb 2013 at 12:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The problem is understood, but I'm inclined to say that this is "by design". A 
single request parameter name can have multiple values. The <h:link 
includeViewParams="true"> also works that way.

I could add a check which filters duplicate values on a single parameter, but 
can't you for example just inject CompanyBean or even its compantId property in 
AddressBean?

Original comment by balusc on 12 Feb 2013 at 1:04

GoogleCodeExporter commented 9 years ago
Well, your idea of injecting CompanyBean into AddressBean could work - but I 
like my AddressBean with it's own params and -validation, usable after 
initialization "by view" as the AddressBean can be used for other entities 
(user, ...), too; Instead of injecting I choose to live with this urls.

Anyhow, I didn't know, that HTTP-GET params are allowed to have multiple values 
- so, there is no problem from my point of view.

Original comment by markus.s...@wer-kennt-wen.de on 12 Feb 2013 at 1:23

GoogleCodeExporter commented 9 years ago
I decided to fix it anyway. The <f:viewParam> does at its own not support 
multiple values, so having multiple <f:viewParam> tags on the same parameter 
shouldn't be interpreted as a single parameter with multiple values.

http://code.google.com/p/omnifaces/source/detail?r=5329ccd5e2f7584c477c47d83345d
8c633c1151b

The attached snapshot contains the fix.

Original comment by balusc on 12 Feb 2013 at 3:17

Attachments: