Redirect in Controller doesn't work

UI Components for JSF
jmcollin92
Posts: 145
Joined: 05 Nov 2009, 22:32

15 Nov 2009, 00:45

Hello there,

I'm using the Optimus ViewIdBasedNavigationHandler and I experiences that something like :

Code: Select all

public java.lang.String _action2()
    {
        ...
        return "redirect:page1";
    }
in controller's action don't work. Is it a know issue ?
The documentation talks about redirect directly in views but not about redirect in controller.

Thank's for your answer.
----
Primefaces 2.0.1-SNAPSHOT
JBoss 6.0.0-M2
Mojorra 2.0.2
---

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Nov 2009, 16:33

Hi, are you sure the action method is called? Does it navigate but forward?

jmcollin92
Posts: 145
Joined: 05 Nov 2009, 22:32

20 Nov 2009, 22:42

Yes I'm sure the method is called. There is no redirect and no forward. Nothing happen.
Should that work's ?
----
Primefaces 2.0.1-SNAPSHOT
JBoss 6.0.0-M2
Mojorra 2.0.2
---

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

23 Nov 2009, 01:46

Do you have navigation handler defined in faces-config.xml?

jmcollin92
Posts: 145
Joined: 05 Nov 2009, 22:32

24 Nov 2009, 00:06

Here is the begining of my faces-config.xml. I think it's good.

Code: Select all

<faces-config>
    <application>
		<navigation-handler>org.primefaces.optimus.navigationhandler.ViewIdBasedNavigationHandler</navigation-handler>
		<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    </application>
----
Primefaces 2.0.1-SNAPSHOT
JBoss 6.0.0-M2
Mojorra 2.0.2
---

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 Nov 2009, 18:23

Just to make sure do you have page1.xhtml page? Showcase seems to be working;

http://97.107.138.40:8080/prime-showcas ... source.jsf

jmcollin92
Posts: 145
Joined: 05 Nov 2009, 22:32

29 Nov 2009, 13:05

It works with "redirect:" directly in facelet but not if it is embedded in a controller return.
ie :

Code: Select all

<p:commandButton ... action="redirect:nextPage"/> is working
but not :

Code: Select all

<p:commandButton ... action="#controllerBean.doIt"/>

ControllerBean.doIt() {
...
return "redirect:nextPage";
}
To my opinion the second form should work as well.

Do you think so ?

If not it is not possible to do redirect like in "standard" JSF with <redirect/> in face-config.xml navigation rules.
----
Primefaces 2.0.1-SNAPSHOT
JBoss 6.0.0-M2
Mojorra 2.0.2
---

jmcollin92
Posts: 145
Joined: 05 Nov 2009, 22:32

29 Nov 2009, 19:57

OK, I have put breakpoint in the ViewIdBasedNavigationHandler code, and the redirect is well done :) .
The problem is client side :o .

To make the redirect work, I have to specify async="false" in the "p:commandButton" and then the redirect is OK. Is it normal ?

But in this case (when I put async="false"), if the validation of the form failed (so we stay on the current page), the display is broken (h:outputLabel not shown, wrong label button, panel without title, ...).
See when normal :Image
and when broken : Image

So...
if I do not put async="false", redirection failed and validations is ok,
but if I put it, redirection failed and form validation break the page. :(

Note : I try to suppress all the Panel but same problems remains (page is broken when validation fails).

A help will be appreciate... No more idea to test.
----
Primefaces 2.0.1-SNAPSHOT
JBoss 6.0.0-M2
Mojorra 2.0.2
---

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Dec 2009, 16:18

Can you try this one;

Code: Select all

<p:commandButton async="false" immediate="true" actionListener="#{bean.method}"/>

jmcollin92
Posts: 145
Joined: 05 Nov 2009, 22:32

04 Dec 2009, 23:53

cagatay.civici wrote:Can you try this one;

Code: Select all

<p:commandButton async="false" immediate="true" actionListener="#{bean.method}"/>
I've tried but if immediate="true" the form values are not passed to the backing bean (normal ...) and it's not acceptable in my case.

So I've tried only async="false" and actionListerne="#{bean.mthpd}" and the result is exactly the same with action="#{bean.method}".

I think it's a client side problem in PrimeFaces but I don't know where to search for a solution.

Do you need a simple repro case ?
----
Primefaces 2.0.1-SNAPSHOT
JBoss 6.0.0-M2
Mojorra 2.0.2
---

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests