You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Bill Lucy (JIRA)" <de...@myfaces.apache.org> on 2015/10/19 16:54:05 UTC

[jira] [Commented] (MYFACES-3986) viewScope implicit object not resolved in a JSP page

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

Bill Lucy commented on MYFACES-3986:
------------------------------------

I agree with Jay's analysis and fix here; I've provided a patch with his suggested change.  If there are no objections by the end of the week I'll go ahead and commit this.

> viewScope implicit object not resolved in a JSP page
> ----------------------------------------------------
>
>                 Key: MYFACES-3986
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3986
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-344
>    Affects Versions: 2.2.8
>            Reporter: Jay Sartoris
>         Attachments: MYFACES-3986.patch
>
>
> Consider this scenario:
> A JSP file has the following contents:
> =============
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
>       xmlns:f="http://xmlns.jcp.org/jsf/core"
>       xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" >
> <body>
> <f:view>
>  <h:form id="form1">
>   <c:set target="${viewScope}" property="test" value="testValue2" />
>   <h:outputText id="foo1" value="#{viewScope.test}" />
>  </h:form>
> </f:view>
> </body>
> </html>
> ============
> When requested (with the faces mapping), it fails with this exception:
> javax.servlet.jsp.JspTagException:
> at org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.java:195)
> at [internal classes]
> The reason for that exception is because the target attribute with a value of "viewScope" of the c:set tag was resolved to null. 
> The Problem:
> -----------
> I think the issue here is that the wrong FacesCompositeELResolver is used while processing the tags.  From my debugging, I see that there are two FacesCompositeELResolvers created in this scenario and also what is mentioned in the JSF 2.2 spec, section 5.6.  One with JSP scope and one with Faces scope.  The ImplicitElResolvers created in each of these scopes is different as detailed in the spec.  
> The problem I see is that when processing the tags, the Faces scoped ELResolvers are created, but not used when processing the c:set tag to resolve the viewScope implicit map.  When processing this tag, it will use the JSP scoped resolvers and therefore cannot resolve the viewScope and throws the exception mentioned above because the org.apache.myfaces.el.unified.resolver.implicitobject.ViewScopeImplicitObject is never called as it is only associated with a Faces scoped ImplicitObjectResolver.
> Even though this is a JSP file, shouldn't the Faces scoped resolvers be used when this is a JSF file? 
>  
> This same scenario works on Mojarra 2.2.10 with Tomcat 8.0.15, but fails when using MyFaces.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Re: [jira] [Commented] (MYFACES-3986) viewScope implicit object not resolved in a JSP page

Posted by Bill Lucy <wt...@gmail.com>.
Thanks a lot for this information, Mike.  I'll keep this in mind going
forward.

Regards,
Bill

On Mon, Oct 19, 2015 at 10:58 AM, Mike Kienenberger <mk...@gmail.com>
wrote:

> Bill,
>
> We use the commit-then-review (CTR) policy at MyFaces.   Commit your
> patch, the commit diff will hit the dev mailing list, and if someone
> has an issue with it, they'll speak up, and we can either revert or
> modify it at that point.  It's extremely rare that this happens.
>
> Now if you think that your patch would be controversial, then you
> might call for comments first.
>

Re: [jira] [Commented] (MYFACES-3986) viewScope implicit object not resolved in a JSP page

Posted by Mike Kienenberger <mk...@gmail.com>.
Bill,

We use the commit-then-review (CTR) policy at MyFaces.   Commit your
patch, the commit diff will hit the dev mailing list, and if someone
has an issue with it, they'll speak up, and we can either revert or
modify it at that point.  It's extremely rare that this happens.

Now if you think that your patch would be controversial, then you
might call for comments first.