As a work around I simpliy extended MyFacesGenericPortlet and overrode the processAction method like this...

Code:
 /**
* Called by the portlet container to allow the portlet to process an action request.
*/
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException
{
if (log.isTraceEnabled()) log.trace("called processAction");

if (sessionTimedOut(request)) return;

setPortletRequestFlag(request);

FacesContext facesContext = facesContext(request, response);


try
{
lifecycle.execute(facesContext);
//check to see if id is null is so set default view as id
if(facesContext.getViewRoot().getViewId()==null)
{
facesContext.getViewRoot().setViewId(this.defaultView);
}
if (!facesContext.getResponseComplete())
{
response.setRenderParameter (VIEW_ID, facesContext.getViewRoot().getViewId());
}

request.getPortletSession().setAttribute(CURRENT_FACES_CONTEXT, facesContext);
}
catch (Throwable e)
{
facesContext.release();
handleExceptionFromLifecycle(e);
}
}





I don't have enough experience with the portal yet to know if this fix will have adverse effects yet but it seems ok so far. If anyone has any information on this issue I would appreciate it.


On 10/3/05, Galen Dunkleberger <[EMAIL PROTECTED] > wrote:
I also posted this question on the JBoss Portal forum and Julien, the JBoss Portal project lead, said he also came across this issue and doesn't seem to know what is causing it so I'm thinking it might be a MyFaces issue. So now my question is would it be wrong to check for a null viewId in the processAction method of the MyFacesGenericPortlet and if it's null perform the same actions that occur in the nonFacesRequest method where you create a new viewRoot and set the viewId to be the default view? Or is there a better solution?


On 10/3/05, Galen Dunkleberger <[EMAIL PROTECTED] > wrote:
Not sure if this is an issue with MyFaces or the JBoss Portal implementation so I'll throw it to all of you guys first and see if you've ever come across the problem. So I'm using JBoss Portal 2.0.1 RC1 with the latest nightly build of MyFaces. If I use the default portal and create a new portlet using MyFacesGenericPortlet the interface renders, I can navigate to my portlet, everything works great. If I declare a separate portal instance within the portal server (so i now have a *-portal.xml configuration file) and I say I want to use one of my MyFacesGenericPortlet's as the default portlet and I navigate to the portal using a url like http://localhost:8080/portal/myportal/ i get the following exception....

javax.portlet.PortletException: value must not be null
org.apache.myfaces.portlet.MyFacesGenericPortlet.handleExceptionFromLifecycle(MyFacesGenericPortlet.java:254)
org.apache.myfaces.portlet.MyFacesGenericPortlet.processAction


(MyFacesGenericPortlet.java:233)

snipped...


However, if I put the entire url in like this http://localhost:8080/portal/myportal/?ctrl:id=page.myportal.myTest it once again renders fine. I did some debugging through the code and it seems that when I use the first url to navigate to the portal the processAction method is called on MyFacesGenericPortlet. It blows up because no viewId has been set in the view root. However if I navigate to the portal using the second url the nonFacesRequest(RenderRequest request, RenderResponse response) method is called which of course sets the viewId of the view root and it renders fine.

So my question is why when trying to navigate to the default page does the portal call processAction on MyFacesGenericPortlet? Is this a JBoss Portal problem or a MyFacesGenericPortlet problem? Does anyone know a fix for this?

                                             Thanks


Reply via email to