【发布时间】:2019-08-11 04:35:21
【问题描述】:
首先。我的 Java 项目使用:
- NetBeans IDE 8.2
- Maven -> 网络应用程序
- 框架:JavaServer Faces 2.2 和 PrimeFaces
我用过的其他东西:
- Apache Tomcat 8.0.27.0
- postgresql
- pgAdmin4
我在很多地方搜索过,但找不到一件事:单击按钮后如何在其他页面中打开页面。为了更好地描述它下面的2个文件:
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>
我想按下菜单中的按钮(Menu1-> Button1)并在标有注释的地方(index.xhtml)打开页面(examplePage.xhtml)。
我找不到如何做的答案。谁能帮帮我?
【问题讨论】:
标签: jsf primefaces