You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Andraschko (Jira)" <de...@myfaces.apache.org> on 2020/06/23 12:57:00 UTC

[jira] [Commented] (MYFACES-4346) The ClientBehaviorContext.Parameter is not available from requestParameterMap

    [ https://issues.apache.org/jira/browse/MYFACES-4346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17142902#comment-17142902 ] 

Thomas Andraschko commented on MYFACES-4346:
--------------------------------------------

Could you give me a example? Would be great if you can fork https://github.com/primefaces/primefaces-test, so i can compare different impls and versions

> The ClientBehaviorContext.Parameter is not available from requestParameterMap
> -----------------------------------------------------------------------------
>
>                 Key: MYFACES-4346
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4346
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.3-next-M2
>            Reporter: Jan Krpata
>            Priority: Major
>
>  
> The ClientBehaviorContext.Parameter is not available from requestParameterMap.
>  
> This is part of my component renderer.
>  
> {code:java}
> public String onclick(UIComponent component, FacesContext context) {
>   Collection<ClientBehaviorContext.Parameter> paramList = new ArrayList<>();
>   paramList.add(new javax.faces.component.behavior.ClientBehaviorContext.Parameter("my_param", "my_value"));
>   Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
>   String onclick = ClientBehaviorRendererUtils.buildBehaviorChain(context, component, component.getClientId(), ClientBehaviorEvents.CLICK, paramList, ClientBehaviorEvents.ACTION, paramList, behaviors, null , null);
>   return onclick;
> }
> {code}
> When i decode component parameter value is not available in requestParameterMap.
>  
>  
> {code:java}
> Map<String,String> paramMap = facesContext.getExternalContext().getRequestParameterMap();
> // this works in 2.2.8
> String myParamValue = paramMap.get("my_param"); // null
> // in 2.3-next parameters are wrapped in params
> String paramValue = paramMap.get("params"); // [object Object]{code}
> This is because the paramater is wrapped in params in AjaxScriptBuilder.
>  
> {code:java}
> params: {
>   my_param: my_value
> }
> {code}
> During parameter processing in the jsf send method, the encodeURIComponent(val) is called, where var is just 'my_param: "my_value"'. The result of this method is '[object=Object]'.
>  
> If I locally canceled the wrapping of parameters in AjaxScritBuilder into params, then everything started working again as in my old MyFaces version 2.2.8.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)