[ 
https://issues.apache.org/jira/browse/MYFACES-4438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Volodymyr Siedlecki resolved MYFACES-4438.
------------------------------------------
    Resolution: Won't Fix

Closing as won't fix.  This behavior doesn't appear to be spec defined, and I 
don't see many developers retrieving the {{FaceletContext}}

However, workarounds for this exist:

1) Using c:set and 
{{FacesContext.getCurrentInstance().getExternalContext().getRequest();}} and 
retrieving the attribute.

2) Sending the ui:param as a f:param which could then be retrieved via  a get 
call from {{FacesContext.getExternalContext().getRequestParameterMap();


One last note: the FaceletContext.FACELET_CONTEXT_KEY value changed from 
*com.sun.faces.facelets.FACELET_CONTEXT* in 2.0 to 
*javax.faces.FACELET_CONTEXT* in 2.2.  }}

> Clarify FaceletContext.getAttribute() (Retrieving ui:param from bean) 
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-4438
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4438
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.0.24, 2.2.15, 2.3.10, 3.0.2
>            Reporter: Volodymyr Siedlecki
>            Priority: Minor
>         Attachments: MYFACES4438.zip
>
>
> {color:#0e101a}I have a scenario with the following code where retrieving 
> "dataId{color}" from the FaceletContext return null.
>  
> index.xhtml:
> {quote}{color:#808080}<{color}{color:#569cd6}ui:composition{color}{color:#d4d4d4}
>  
> {color}{color:#9cdcfe}template{color}{color:#d4d4d4}={color}{color:#ce9178}"layout.xhtml"{color}{color:#808080}>{color}{color:#d4d4d4}
>  {color}{color:#808080}<{color}{color:#569cd6}ui:param{color}{color:#d4d4d4} 
> {color}{color:#9cdcfe}name{color}{color:#d4d4d4}={color}{color:#ce9178}"dataId"{color}{color:#d4d4d4}
>  
> {color}{color:#9cdcfe}value{color}{color:#d4d4d4}={color}{color:#ce9178}"foo"{color}{color:#808080}
>  /></{color}{color:#569cd6}ui:composition{color}{color:#808080}>{color}
> {quote}
> {color:#0e101a}Managed Bean:{color}
> {quote}{color:#d4d4d4} 
> {color}{color:#4ec9b0}FaceletContext{color}{color:#d4d4d4} 
> {color}{color:#9cdcfe}faceletContext{color}{color:#d4d4d4} = 
> ({color}{color:#4ec9b0}FaceletContext{color}{color:#d4d4d4}){color}{color:#9cdcfe}FacesContext{color}{color:#d4d4d4}.{color}{color:#dcdcaa}getCurrentInstance{color}{color:#d4d4d4}().{color}{color:#dcdcaa}getAttributes{color}{color:#d4d4d4}().{color}{color:#dcdcaa}get{color}{color:#d4d4d4}({color}{color:#9cdcfe}FaceletContext{color}{color:#d4d4d4}.{color}{color:#9cdcfe}FACELET_CONTEXT_KEY{color}{color:#d4d4d4});{color}
> {color:#9cdcfe} 
> faceletContext{color}{color:#d4d4d4}.{color}{color:#dcdcaa}getAttribute{color}{color:#d4d4d4}({color}{color:#ce9178}"dataId"{color}{color:#d4d4d4}){color}
>  
> {quote}
> {color:#0e101a} {color}
> {color:#0e101a}I found that this code above works in Mojarra 2.2.x but not in 
> MyFaces. I also found some variation in behavior between versions in 
> MyFaces.{color}
>  
> {color:#0e101a}Myfaces 2.0.25: 
> FacesContext.getCurrentInstance().getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY)
>  returns null {color}
>  
> {color:#0e101a}MyFaces 2.2.0 and higher: 
> faceletContext.getAttribute("dataId"); returns null{color}
>  
> However, if the 
> "{color:#9cdcfe}faceletContext{color}{color:#d4d4d4}.{color}{color:#dcdcaa}getAttribute{color}{color:#d4d4d4}({color}{color:#ce9178}"dataId"{color}{color:#d4d4d4})"
>  {color}is within a  @PostConstruct method, it works in MyFaces 2.2.  (See 
> app)
> {color:#808080}
> {color}
> {color:#0e101a}In some old posts [1], BalusC mentioned that FaceletContext is 
> only available at build time (restore view phase). (And he also said 
> FaceletContext is not supported in MyFaces but then again it's a post from 
> 2012). Is this still true for 2.2/2.3 and newer? Should 
> getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY) also return null as 
> it did in 2.0.x?  It doesn't seem to be nulled out in 2.2. {color}
> {color:#0e101a}I think BalusC is correct because when I use c:set (also build 
> time), the faceletContext attribute map did contain the "dataId" value during 
> the @PostConstruct method of the bean.   {color}
> {color:#0e101a}What's the correct behavior here? The implementation is quite 
> confusing as the FaceletContext.FACELET_CONTEXT_KEY value within the 
> attribute map is set and restored numerous times.{color}
> {color:#0e101a}Any guidance is appreciated. {color}
>  
> {color:#0e101a}Old discussion here: {color}
> 1) 
> [{color:#4a6ee0}[https://stackoverflow.com/questions/13930629/uiinclude-using-faceletscontext]{color}]{color:#0e101a}
>  {color}
> [{color:#4a6ee0}[https://stackoverflow.com/questions/14745259/how-to-create-uiinclude-tag-programmatically]{color}]{color:#0e101a}
>  {color}
>  
>  
> {color:#0e101a} Issues which touch on FaceletContext: {color}
> {color:#0e101a}- {color}{color:#4a6ee0} 
> https://issues.apache.org/jira/browse/MYFACES-3246{color}
> {color:#0e101a}- 
> {color}{color:#4a6ee0}https://issues.apache.org/jira/browse/MYFACES-3848{color}{color:#0e101a}
>  {color}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to