Fórum

redirect - File "/el/web.jsp" not found

Vassilis Petropoulos, modificado 11 Anos atrás.

redirect - File "/el/web.jsp" not found

Junior Member Postagens: 26 Data de Entrada: 10/04/12 Postagens Recentes
Hi, Neil

i have a simple form with an h:commandButton, like this:
<h:commandButton value="test" action="#{loginAction.login}" />
LoginAction:
public void login() {
FacesContext.getCurrentInstance().getExternalContext().redirect("/el/web");
}
Running this, the following is printed:
Caused by: java.io.IOException: javax.servlet.ServletException: File &quot;/el/web.jsp&quot; not found
at com.liferay.faces.bridge.context.BridgeContextImpl.dispatch(BridgeContextImpl.java:207)
at com.liferay.faces.bridge.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:185)
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
at com.liferay.faces.bridge.application.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:36)
at com.liferay.faces.bridge.application.view.ViewDeclarationLanguageJspImpl.buildView(ViewDeclarationLanguageJspImpl.java:53)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

If i change h:commandButton to p:commandButton (primefaces button -> ajax request) everything works fine.


Regards
Vassilis
Vassilis Petropoulos, modificado 11 Anos atrás.

RE: redirect - File &quot;/el/web.jsp&quot; not found

Junior Member Postagens: 26 Data de Entrada: 10/04/12 Postagens Recentes
Hi,

it seems that redirection works differently between a) ajax and b) post requests.
When a) then redirect path must be a liferay path, eg /en/web/myPage1
When b) then redirect path must be a faces path (war), eg /xhtml/myPage2.xhtml.

Both cases throw java.io.IOException: javax.servlet.ServletException when they are not satisfied.

Any comments?

Regards,
Vassilis
thumbnail
Neil Griffin, modificado 11 Anos atrás.

RE: redirect - File &quot;/el/web.jsp&quot; not found

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Redirect during Ajax is a special use-case that is not covered in the JSR 329 spec, but has specific requirements in JSR 314 (JSF 2.0) that I believe the bridge handles correctly since FACES-258 was fixed. For more information, see the JavaDocs for ExternalContext.html#redirect(java.lang.String)

Redirect during a full HTTP postback (ActionRequest/ActionResponse) is something that is indeed covered by the JSR 329 spec, and the bridge passes the JSR 329 TCK for those requirements.

So I guess my question would be, which do you want to do? Redirect during Ajax, or redirect during full HTTP postback?