import com.ibm.xsp.util.FacesUtil; import javax.faces.context.FacesContext; return FacesUtil.makeUrlAbsolute(FacesContext.getCurrentInstance(), context.getExternalContext().getRequestContextPath())+"/"; You can use the code in a variableResolver: (http://openntf.org/XSnippets.nsf/snippet.xsp?id=sample-variableresolver) if ("getBaseURL".equals(name)) { return FacesUtil.makeUrlAbsolute(FacesContext.getCurrentInstance(), context.getExternalContext().getRequestContextPath())+"/"; } In your XPage, you can then access the variable: <xp:this.pageBaseUrl> <xp:baseUrl href="#{getBaseURL}"></xp:baseUrl> </xp:this.pageBaseUrl>