cant navigate to other site

UI Components for JSF
Post Reply
varunagrawal
Posts: 36
Joined: 12 Aug 2010, 15:49

20 Sep 2010, 17:43

Hi,
I have a form with commandbutton. When I click the command button , I want to navigate to a completely different website.However when I click it, I remain on the same page.
Here is my code.

<h:form>
<h:outputText title="Email" value="Amount"></h:outputText>
<h:inputText title="email" value="#{Consume.amount}" style=" min-width: 150px;"></h:inputText>
<p:commandButton actionListener="http://www.resourceresidential.com" value="submit" ajax="false" ></p:commandButton>
</h:form>

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

20 Sep 2010, 18:29

Hi,

Usually you should "action" for navigaion, instead of "actionListner".

you should define your navigation rules in your faces-config file. ie:

<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-f ... ig_1_2.xsd">
<navigation-rule>
<navigation-case>
<from-outcome>resourceresidential</from-outcome>
<to-view-id>http://www.resourceresidential.com</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>


<h:form>
<h:outputText title="Email" value="Amount"></h:outputText>
<h:inputText title="email" value="#{Consume.amount}" style=" min-width: 150px;"></h:inputText>
<p:commandButton action="resourceresidential" value="submit" ajax="false" ></p:commandButton>
</h:form>


I am not sure if this works for view in external site but if it doesn't you can always use redirect from you java back bean.


Cheers,

Tamir
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

15 Oct 2010, 23:48

Apparently you should use h:outputLink to navigate to another site.
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

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

16 Oct 2010, 12:03

Try p:button, h:outputLink or h:link.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 63 guests