You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Sean Taylor <da...@bluesunrise.com> on 2004/12/02 17:58:33 UTC

portlet:defineObjects

Im trying to write a portlet with MyFaces

The portlet api's <portlet:defineObjects> defines the page context 
variable 'renderRequest' shown below.

Using ${renderRequest.porletMode} works fine.
However '#{renderRequest.portletMode} fails

Is this a bug or am I making a wrong assumption here...

<%@ page session="false" %>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet' %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix='c' %>
<%@ taglib uri='http://java.sun.com/jsf/html' prefix='h' %>
<%@ taglib uri='http://java.sun.com/jsf/core' prefix='f' %>
<portlet:defineObjects/>
<f:view>
     <h:outputText value='#{renderRequest.portletMode}'/><br>   <-- FAILS
     <c:out value="${renderRequest.portletMode}"/>           <-- SUCCEEDS
</f:view>

Re: portlet:defineObjects

Posted by David Sean Taylor <da...@bluesunrise.com>.
Craig McClanahan wrote:

> 
> Unfortunately, there would be a very definite harm to doing this ...
> applications depending on it would work in Pluto and fail in every
> other JSR-168 compatible container :-(.
> 
Oh yeah, that 'standard' thing
I talked to Stefan and is going to add to his list of v.1.1 'issues'


Re: portlet:defineObjects

Posted by Craig McClanahan <cr...@gmail.com>.
On Thu, 02 Dec 2004 10:45:52 -0800, David Sean Taylor
<da...@bluesunrise.com> wrote:
> Craig McClanahan wrote:
> 
> 
> 
> > David,
> >
> > The problem here is that page scope is not visible to JSF expressions
> > ... only request, session, and application are visible.  The reason
> > for this is that JSF expressions can be evaluated programmatically, in
> > contexts where there is no JSP page, so there would be no way to
> > access a PageContext.
> >
> > Can <portlet:defineObjects> put things in other scopes instead?  If
> > not, that's a suggestion you might want to take back to the portlet
> > spec expert group.
> >
> 
> We are using the Pluto portlet tag lib, so yes, being a committer there,
> I can change it:
> 
>      public int doStartTag() throws JspException
> ....
>              pageContext.setAttribute("renderResponse",
>                                       renderResponse,
>                                       PageContext.PAGE_SCOPE);
> 
> Although the spec clearly states it should be on page scope, I guess it
> wouldn't hurt to be on request scope.
> 

Unfortunately, there would be a very definite harm to doing this ...
applications depending on it would work in Pluto and fail in every
other JSR-168 compatible container :-(.

Craig

> One of my collegues (Stephan Hesmer) just tried this and tells me it
> also fails. Are we still misinterpreting something here:
> 
> 
> 
> <%@ page session="false" %>
> <%@ page import="javax.portlet.*"%>
> <%@ page import="java.util.*"%>
> <%@ taglib uri='http://java.sun.com/portlet' prefix='portlet' %>
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix='c' %>
> <%@ taglib uri='http://java.sun.com/jsf/html' prefix='h' %>
> <%@ taglib uri='http://java.sun.com/jsf/core' prefix='f' %>
> <portlet:defineObjects/>
> <%
> request.setAttribute("renderRequest",request.getAttribute("javax.portlet.request"));
>                                <<<<<< "javax.portlet.request" defined by the
> Portlet Spec
> %>
> <f:view>
>      renderRequest#1: <h:outputText
> value='#{requestScope.renderRequest.portletMode}'/><br>
>      renderRequest#2: <h:outputText
> value='#{renderRequest.portletMode}'/><br>
>      javax.request.request: <h:outputText
> value='#{javax.portlet.request.portletMode}'/><br>
>      JSTL: <c:out value="${renderRequest.portletMode}"/><br>
> </f:view>
> 
> --
> David Sean Taylor
> Bluesunrise Software
> david@bluesunrise.com
> [office] +01 707 773 4646
> [mobile] +01 707 529 9194
>

Re: portlet:defineObjects

Posted by David Sean Taylor <da...@bluesunrise.com>.
Craig McClanahan wrote:

> David,
> 
> The problem here is that page scope is not visible to JSF expressions
> ... only request, session, and application are visible.  The reason
> for this is that JSF expressions can be evaluated programmatically, in
> contexts where there is no JSP page, so there would be no way to
> access a PageContext.
> 
> Can <portlet:defineObjects> put things in other scopes instead?  If
> not, that's a suggestion you might want to take back to the portlet
> spec expert group.
> 

We are using the Pluto portlet tag lib, so yes, being a committer there, 
I can change it:

     public int doStartTag() throws JspException
....
             pageContext.setAttribute("renderResponse",
                                      renderResponse,
                                      PageContext.PAGE_SCOPE);

Although the spec clearly states it should be on page scope, I guess it 
wouldn't hurt to be on request scope.

One of my collegues (Stephan Hesmer) just tried this and tells me it 
also fails. Are we still misinterpreting something here:

<%@ page session="false" %>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet' %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix='c' %>
<%@ taglib uri='http://java.sun.com/jsf/html' prefix='h' %>
<%@ taglib uri='http://java.sun.com/jsf/core' prefix='f' %>
<portlet:defineObjects/>
<%
request.setAttribute("renderRequest",request.getAttribute("javax.portlet.request"));
                               <<<<<< "javax.portlet.request" defined by the
Portlet Spec
%>
<f:view>
     renderRequest#1: <h:outputText
value='#{requestScope.renderRequest.portletMode}'/><br>
     renderRequest#2: <h:outputText
value='#{renderRequest.portletMode}'/><br>
     javax.request.request: <h:outputText
value='#{javax.portlet.request.portletMode}'/><br>
     JSTL: <c:out value="${renderRequest.portletMode}"/><br>
</f:view>


-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773 4646
[mobile] +01 707 529 9194

Re: portlet:defineObjects

Posted by Craig McClanahan <cr...@gmail.com>.
David,

The problem here is that page scope is not visible to JSF expressions
... only request, session, and application are visible.  The reason
for this is that JSF expressions can be evaluated programmatically, in
contexts where there is no JSP page, so there would be no way to
access a PageContext.

Can <portlet:defineObjects> put things in other scopes instead?  If
not, that's a suggestion you might want to take back to the portlet
spec expert group.

Craig McClanahan


On Thu, 02 Dec 2004 08:58:33 -0800, David Sean Taylor
<da...@bluesunrise.com> wrote:
> Im trying to write a portlet with MyFaces
> 
> The portlet api's <portlet:defineObjects> defines the page context
> variable 'renderRequest' shown below.
> 
> Using ${renderRequest.porletMode} works fine.
> However '#{renderRequest.portletMode} fails
> 
> Is this a bug or am I making a wrong assumption here...
> 
> <%@ page session="false" %>
> <%@ page import="javax.portlet.*"%>
> <%@ page import="java.util.*"%>
> <%@ taglib uri='http://java.sun.com/portlet' prefix='portlet' %>
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix='c' %>
> <%@ taglib uri='http://java.sun.com/jsf/html' prefix='h' %>
> <%@ taglib uri='http://java.sun.com/jsf/core' prefix='f' %>
> <portlet:defineObjects/>
> <f:view>
>      <h:outputText value='#{renderRequest.portletMode}'/><br>   <-- FAILS
>      <c:out value="${renderRequest.portletMode}"/>           <-- SUCCEEDS
> </f:view>
>

RE: portlet:defineObjects

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
> David hopes to contribute a tree/table component to MyFaces that he 
> developed for Jetspeed eventually


yap, I saw the tree enhancement on Jira.

Regards,
Matthias


Re: portlet:defineObjects

Posted by David Sean Taylor <da...@bluesunrise.com>.
Matthias Wessendorf wrote:

> David,
> 
> thanks for using MyFaces.
>
thank you, we are really enjoying using it.

> JSF-Spec says nothing about PageContext variables.
> 
Yes, I am surprised, but Craig explained why

> The VaribleResolver for JSF-EL must know these:
> -applicationScope
> -cookie
> -facesContext
> -header
> -headerValues
> -initParam
> -param
> -paramValues
> -requestScope
> -sessionScope
> -view
> 
> The Jetspeed folks, especial David Le Strat,
> have created a MyFaces-Portlet-Bridge. I guess
> he knows more on JSF<-->Portlet.
> 
I worked on the bridge with David and am also on the Jetspeed team

David hopes to contribute a tree/table component to MyFaces that he 
developed for Jetspeed eventually

RE: portlet:defineObjects

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
David,

thanks for using MyFaces.

JSF-Spec says nothing about PageContext variables.

The VaribleResolver for JSF-EL must know these:
-applicationScope
-cookie
-facesContext
-header
-headerValues
-initParam
-param
-paramValues
-requestScope
-sessionScope
-view

The Jetspeed folks, especial David Le Strat,
have created a MyFaces-Portlet-Bridge. I guess
he knows more on JSF<-->Portlet.

HTH,
Matthias



> -----Original Message-----
> From: David Sean Taylor [mailto:david@bluesunrise.com] 
> Sent: Thursday, December 02, 2004 5:59 PM
> To: MyFaces Discussion
> Subject: portlet:defineObjects
> 
> 
> Im trying to write a portlet with MyFaces
> 
> The portlet api's <portlet:defineObjects> defines the page context 
> variable 'renderRequest' shown below.
> 
> Using ${renderRequest.porletMode} works fine.
> However '#{renderRequest.portletMode} fails
> 
> Is this a bug or am I making a wrong assumption here...
> 
> <%@ page session="false" %>
> <%@ page import="javax.portlet.*"%>
> <%@ page import="java.util.*"%>
> <%@ taglib uri='http://java.sun.com/portlet' prefix='portlet' 
> %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix='c' 
%> <%@ taglib > uri='http://java.sun.com/jsf/html' prefix='h' %> <%@
taglib 
> uri='http://java.sun.com/jsf/core' prefix='f' %> 
> <portlet:defineObjects/> <f:view>
>      <h:outputText value='#{renderRequest.portletMode}'/><br> 
>   <-- FAILS
>      <c:out value="${renderRequest.portletMode}"/>           
> <-- SUCCEEDS
> </f:view>
>