Created
September 19, 2017 13:27
-
-
Save stefanwendelmann/ccc1ac9ec675c8efca08a4b911e6bed8 to your computer and use it in GitHub Desktop.
nav
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Object createManagedBean(String aName) | |
| { | |
| FacesContext fc = FacesContext.getCurrentInstance(); | |
| Application app = fc.getApplication(); | |
| // Bean löschen | |
| deleteManagedBean(aName); | |
| // Bean setzen | |
| //Object result = app.getVariableResolver().resolveVariable(FacesContext.getCurrentInstance(), aName); | |
| Object result = app.getELResolver().getValue(fc.getELContext(), null, aName); | |
| return result; | |
| } | |
| public static String openNewPage(String aWebPage, boolean redirect) | |
| { | |
| Object webPage = createManagedBean(QString.firstToLower(aWebPage)); | |
| String target = aWebPage; | |
| if (redirect) | |
| { | |
| target += "?faces-redirect=true"; | |
| } | |
| return target; | |
| } | |
| public String jump(String aTargetPage) | |
| { | |
| FacesContext facesContext = FacesContext.getCurrentInstance(); | |
| String viewId = facesContext.getViewRoot().getViewId(); | |
| String beanname = WebHelper.pageName2Bean(viewId); | |
| Object bean = WebHelper.createManagedBean(beanname); | |
| if (bean != null && bean instanceof BaseWebPage) | |
| { | |
| if (!((BaseWebPage) bean).canClose(aTargetPage)) | |
| { | |
| return null; | |
| } | |
| } | |
| return WebHelper.openNewPage(aTargetPage, true); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment