For the start. My Java project uses:
- NetBeans IDE 8.2
- Maven -> Web Application
- Framework: JavaServer Faces 2.2 with PrimeFaces
Other things that I used:
- Apache Tomcat 8.0.27.0
- postgresql
- pgAdmin4
I have searched in many places but I can't find one thing : How to open a page inside other page after click of button. To better describe it below 2 files:
index.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title>MY AWESOME PAGE</title>
</f:facet>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="north" size="100" resizable="true" closable="true" collapsible="true">
HEADER
</p:layoutUnit>
<p:layoutUnit position="west" size="250" header="Menu" collapsible="true">
<h:form>
<p:growl>
<p:autoUpdate />
</p:growl>
<p:panelMenu style="width:300px">
<p:submenu label="Menu1">
<p:menuitem value="Button1"/>
<p:menuitem value="Button2"/>
</p:submenu>
<p:submenu label="Menu2">
<p:menuitem value="Button1"/>
<p:menuitem value="Button2"/>
</p:submenu>
<p:separator />
<p:submenu label="Menu3">
<p:menuitem value="Button1"/>
<p:menuitem value="Button2"/>
</p:submenu>
</p:panelMenu>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<h:form>
<!--
Place where i wanna open page
-->
</h:form>
</p:layoutUnit>
</p:layout>
</h:body>
</f:view>
</html>
examplePage.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
SOME AWESOME CODE HERE
</h:body>
</html>
I would like to press the button in the menu (Menu1-> Button1) and open the page (examplePage.xhtml) in the place marked with a comment (index.xhtml).
I can't find the answer how to do it. Can anyone help me?