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>
cant navigate to other site
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
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
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
Apparently you should use h:outputLink to navigate to another site.
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Try p:button, h:outputLink or h:link.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 63 guests