suggestion for commandButton
Sometimes we want do something and navigate to an othor page in new page.So we need "target" attribute for commandButton. We really hope you to think about it.
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge
Hi,
Did you really understand how JSF navigation work? Use "action" attribute of commandButton for navigation. Return value of action defines your navigation case.
Did you really understand how JSF navigation work? Use "action" attribute of commandButton for navigation. Return value of action defines your navigation case.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
Sorry!
I do use "action" attribute of commandButton for navigation, return value of action defines your navigation case.But I want open the target view in new window.
I do use "action" attribute of commandButton for navigation, return value of action defines your navigation case.But I want open the target view in new window.
primefaces:jakarta:12.0.0.jar,
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge
primefaces-ext:jakarta:12.0.0.jar,
JSF Mojarra 3.0
glassfish-6.2.5,
netbeans 14
IDEA 2022.2.2
Browser: Edge
-
- Posts: 55
- Joined: 08 Sep 2010, 09:18
- Location: Banja Luka, Bosnia and Herzegovina
- Contact:
You can always try to mix in some JavaScript. Here is something that might wotk. I didn't try it.
Code: Select all
<p:commandButton ...
oncomplete="window.open('#{request.contextPath}/faces/newPage.xhtml')"/>
PrimeFaces version: whatever is the latest
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Use p:button for get based navigations.
I know this thread is a little old but I was having the same problem. My solution is below in case it helps anyone. Setting target="_blank" on the form will open a new window with p:commandButton.
Code: Select all
<h:form target="_blank">
<p:commandButton value="Run Report" action="#{reportBean.runReport}" ajax="false" />
</h:form>
Prime Faces 6.2
Mojarra 2.2.14
Apache Tomcat 9.0
Internet Explorer 10,11
Mojarra 2.2.14
Apache Tomcat 9.0
Internet Explorer 10,11
-
- Information
-
Who is online
Users browsing this forum: No registered users and 49 guests