Jan Krpata created MYFACES-4346:
-----------------------------------
Summary: 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
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)