Dec 30, 2011, 6:00 AM
57 Posts

Re: redirecting to another xpage but reqestscope is empty

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: requestScope
  • Replies: 8
solution is to make our own flash scope bean
 
http://www.bleedyellow.com/blogs/andyc/entry/a_flash_scope_for_xpages?lang=en_gb
Dec 30, 2011, 9:25 AM
57 Posts
Re: redirecting to another xpage but reqestscope is empty
FacesContext.getCurrentInstance().getExternalContext().dispatch(arg0)
can not be used in Xpages "Function is not available in the Domino environement " and they spell wrong on this excpetion........."environement",    "environment"
 
but we can do this
pageA.xsp and pageB.xsp
pageA.xsp defines requestScope param, and pageB.xsp catch it
 
put a button in pageA.xsp
 
<xp:button value="Label" id="button1">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:requestScope.paramA="I am requestScope param";
var viewRoot1:UIViewRoot =facesContext.getApplication().getViewHandler().createView(facesContext, "/pageB.xsp");
facesContext.setViewRoot(viewRoot1);
facesContext.renderResponse();
}]]></xp:this.action>
        </xp:eventHandler>
    </xp:button>
Dec 30, 2011, 11:38 AM
272 Posts
Re: redirecting to another xpage but reqestscope is empty
Hi,
 
adding xsp.redirect=false to the xsp.properties-file would give you the same result and it is much easier to implement ;-)
I have written an article about this feature here (on german only).
 
Sven
 
http://blog.hasselba.ch
Dec 30, 2011, 7:08 PM
57 Posts
Re: redirecting to another xpage but reqestscope is empty
thanks, Sven, where did you find the list of configurable properties in xsp.property? 
 
but there is a method for that now, no need to configure in xsp.property 
requestScope.paramA="something";
context.redirectToPage("/pageB.xsp",false);

 
I do believe that the code behind redirect=false, is the more or less the same as manually choosing a page viewroot for rendering
trace of code:
com.ibm.xsp.designer.context.XSPContext.redirectToPage(String paramString, boolean paramBoolean)
com.ibm.xsp.designer.context.XSPContext.renderPage(String paramString, boolean paramBoolean)
com.ibm.xsp.application.NavigationHandlerImpl.createView(localFacesContext, paramString, paramBoolean)
com.ibm.xsp.controller.FacesControllerImpl.restoreView(FacesContext paramFacesContext, String paramString)
 
REF: https://forums.oracle.com/forums/thread.jspa?threadID=654384
 
 

Dec 31, 2011, 12:13 PM
272 Posts
Re: redirecting to another xpage but reqestscope is empty
You can find a description of the properties in the xsp.properties.sample-file. As far as I know, the "XPages Portable Command Guide" (available Feb. 2012) will have a complete(?) list of all properties.
The redirection-parameter will affect ALL redirections (f.e. links etc.), not only the redirects you are do with context.redirectToPage(). If set to false, the request scope will work "as designed".
 
Sven