Web tier: servlets, JSP, Web frameworks: JSF - external link - controller decides to dispatch to a page?

  1. Hi, I have a JSF question. I have an external link, for example: http://localhost:9001/storefoundation/pages/resetPassword.jsf?resetPasswordKey=fea5aea0-1d48-40ee-a5e3-7858dc8cf5b5 After clicking on this link I want to decide to dispatch to a form or if the key is wrong to a page complaining about the key. How can I do this with JSF? In the moment always the form is displayed. Kind regards, Walter
  2. What does it mean by external link? Isn't this link points to JSF app? Anil.
  3. A programmatic way[ Go to top ]

    from an action handler of your managed bean. you can call. /** * Forward inside the jsf app * @param viewId a faces view id ( like /somepath/apage.jsp or /somepath/apage.xhtml) */ void forward(String viewId) { FacesContext facesContext = FacesContext.getCurrentInstance(); String currentViewId = facesContext.getViewRoot().getViewId(); if (viewId != null && (!viewId.equals(currentViewId))) { ViewHandler viewHandler = facesContext.getApplication() .getViewHandler(); UIViewRoot viewRoot = viewHandler.createView(facesContext, viewId); facesContext.setViewRoot(viewRoot); facesContext.renderResponse(); } } /** * Redirect to a new url * @param url an external url */ void redirect(String url) throws IOException{ FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalCtx = facesContext.getExternalContext(); externalCtx.redirect( url); }