Saving current page in scope variable in xPages?

房东的猫 提交于 2019-12-25 08:55:10

问题


After my users complete a form, I want them to return to the page that they were on before completing / editing the form. How can I save the current page in scope variable in xPages?


回答1:


Have you tried using the inbuilt previous page function?

select the button, go to events tab and create an onclick event, in the drop down choose openPage event. Inside there is an option of "previousPage" as the page to move to.

failing that if you have some custom use case, why not have a scope populate in the "beforePageLoad" event on an XPage and either hard code it or if in a custom control figure it out from the URL. you will have to leave it out of the form page or else run script everywhere there is a link / button moving to another page




回答2:


Get the current location using: (xpagescheatsheet.com) Full Path Including page name facesContext.getExternalContext().getRequest().getRequestURI(), store that in a sessionScope variable, then use that value to redirect user as needed.




回答3:


Add the below code in the afterpageLoad event of the view:

sessionScope.put('webFrom',context.getUrl().getSiteRelativeAddress(context))

Add the below code to the onClick event of the link/button, which redirects the user:

var redirectToPage = sessionScope.get('webFrom')||'';
redirectToPage != ''? context.redirectToPage(redirectToPage):context.redirectToHome()


来源:https://stackoverflow.com/questions/10899016/saving-current-page-in-scope-variable-in-xpages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!