This content has been marked as final.
Show 4 replies
-
1. Re: PortalURL call with an action possible?
alexsmirnov Oct 2, 2008 5:16 PM (in response to danielk)Portlet specification allowed redirects at the action phase. Bridge CxternalContext.redirect() method should delegate this call to the appropriate portlet method. This is a scratch for the your action method :
public void callRenderUrl(ActionEven event) { FacesContext context = event.getFacesContext();// or FacesContext.getCurrentInstance(); ExternalContext externalContext = context.getExternalContext(); String url = .... // construct your redirection URL. externalContext.redirect(url); context.responseComplete(); }
-
2. Re: PortalURL call with an action possible?
danielk Oct 3, 2008 5:35 AM (in response to danielk)I think thats exactly what i am searching for. Thanks for your help, i will try it.
-
3. Re: PortalURL call with an action possible?
danielk Oct 6, 2008 4:09 PM (in response to danielk)public void callRenderUrl(ActionEven event) {
FacesContext context = event.getFacesContext();// or FacesContext.getCurrentInstance();
ExternalContext externalContext = context.getExternalContext();
String url = .... // construct your redirection URL.
externalContext.redirect(url);
context.responseComplete();
}
Is not working, if you are using Richfaces with JBoss Portal, because if you call externalContext.redirect(absoluteURL) or ((JBossActionResponse) response).sendRedirect(portalURL) Exception will be thrown, because in this phase setPortletMode was already called. I can post the correct exception here tomorrow, if this helps. But my problem is still there, how can i redirect from my action or actionListener (addActionListener() and setActionExpression() both tried) to a portal page?
Or is it impossible?
Thanks for reading and perhaps answering my question,
DanielK
PS: Background, PanelMenuItem with links is not really cute, because of parts where you can click at, but "nothing" happens (you will only will be redirected to the same portal page). Only if you click at one link into one of these PanelMenuItems, another portal page will be showed.<rich:panelMenu event="onclick" submitMode="none"> <rich:panelMenuItem label="Link to external page"> <h:outputLink ... > <rich:panelMenuItem> </rich:panelMenu>
Example from:
http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/panelMenu.html
Not really good, because only outputLink will be usable, like i described above :(( -
4. Re: PortalURL call with an action possible?
danielk Oct 12, 2008 7:51 AM (in response to danielk)Ok, two pages ahead i found the solution for my problem:
<rich:panelMenu> ... <rich:panelMenuItem submitMode="none" onclick="document.location.href='http://labs.jboss.com/jbossrichfaces/"> <h:outputLink value="http://labs.jboss.com/jbossrichfaces/"> <h:outputText value="RichFaces Home Page"></h:outputText> </h:outputLink> </rich:panelMenuItem> ... </rich:panelMenu>
Its important to use submitMode="none" and i had to use links twice (outputLink and onclick event), perhaps because of 2 different phases? Is not 100% what i want, but perhaps its not possible to make a redirect from actions or actionListeners?