Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Vassilis Petropoulos
redirect - File "/el/web.jsp" not found
5 de Junho de 2012 09:13
Resposta

Vassilis Petropoulos

Ranking: Junior Member

Mensagens: 26

Data de entrada: 10 de Abril de 2012

Mensagens 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
RE: redirect - File &quot;/el/web.jsp&quot; not found
7 de Junho de 2012 07:02
Resposta

Vassilis Petropoulos

Ranking: Junior Member

Mensagens: 26

Data de entrada: 10 de Abril de 2012

Mensagens 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
Neil Griffin
RE: redirect - File &quot;/el/web.jsp&quot; not found
7 de Junho de 2012 08:58
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2511

Data de entrada: 26 de Julho de 2005

Mensagens 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 [url=http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/context/ExternalContext.html#redirect(java.lang.String)]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?

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!