How to redirect to another page when click a commandButton?

UI Components for JSF
Post Reply
keating
Posts: 21
Joined: 08 Nov 2010, 15:18

08 Nov 2010, 17:04

When the commandButton is clicked, it invoke a java method, like this:

Code: Select all

					<h:form>
					<p:commandButton value="new consign" actionListener="#{newConsign.newConsignPage}" style="margin-right:20px;" ajax="false" />					
					</h:form>
In the method 'newConsign.newConsignPage', I do some operations, and then return a String.
If I use the commandButton of JSF 2.0, it's all right. But I need using the commandButton of primefaces, it will not redirect to the new page.

tkernstock
Posts: 65
Joined: 29 Jun 2010, 14:39
Location: Vienna, Austria

08 Nov 2010, 17:15

You have to use action instead of actionListener !
Using: Eclipse 2020-06, Java 8, Primefaces 8, Omnifaces 3.6.1, Payara Server 5.201, Deltaspike 1.8.2

keating
Posts: 21
Joined: 08 Nov 2010, 15:18

08 Nov 2010, 17:31

God.....the same time , I find what's wrong I am.......

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

08 Nov 2010, 21:53

When ajax is on, you need to do redirects.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests