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 15:27:00 UTC

[jira] [Comment Edited] (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=17143024#comment-17143024 ] 

Thomas Andraschko edited comment on MYFACES-4346 at 6/23/20, 3:26 PM:
----------------------------------------------------------------------

AFAICS it worked in 2.3 but i refactored the whole code for 2.3-next.
However, it seems that Mojarra does the same.
So is it ok for you to close it as won't fix and aligned with Mojarra?

UPDATE: will also check its posted now, but the rendering of the AJAX script is the same


was (Author: tandraschko):
AFAICS it worked in 2.3 but i refactored the whole code for 2.3-next.
However, it seems that Mojarra does the same.
So is it ok for you to close it as won't fix and aligned with Mojarra?

> 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)