I would like to redirect to an external URL (something like http://www.google.com) when the user pushes a button.
I can change this to link if I have to, but I would like to keep it as a button to be consistent with other parts of the application.
Any suggestions or links to references?
Thanks.
I tried using things like:
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
response.sendRedirect(sb1.getGoToURL());
but that gives me a page error:
Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
Exception Details: java.lang.IllegalStateException
PWC1227: Cannot forward after response has been committed
Possible Source of Error:
Class Name: org.apache.catalina.core.ApplicationDispatcher
File Name: ApplicationDispatcher.java
Method Name: doForward
Line Number: 400
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
Stack Trace:
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:400)
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
<...snip...>