I´m developing a web application with Primefaces 3.5. I need to redirect/forward the request to another xhtml page without changing the URL address in the address bar, since the main website address is going to be configured in the JBoss server to be accesible from outside.
This is my index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<f:view>
<ui:insert name="metadata"/>
<f:event type="preRenderView" listener="#{forwardBean.forward}" />
<h:body></h:body>
</f:view>
</html>
This is my ForwardBean.java:
(...)
@ManagedBean
@ApplicationScoped
public class ForwardBean {
public void forward() throws IOException {
FacesContext.getCurrentInstance().getExternalContext().redirect("main/SearchForm.xhtml");
The redirect works fine, but changes the URL in the address bar:
http://.../main/SearchForm
Can I redirect without seeing "main" in the address bar? I don´t know if PrettyFaces or any new feature of JSF 2.0 can help, I´m new to this technology.
Thanks in advance!