我正在尝试使用PrimeFaces打印机功能进行打印.我创建了一个新的GlassFish 3 Java EE项目并添加了PrimeFaces 3.1.1 .jar文件.
我目前使用的代码如下:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<h:outputText id="a" value="AA" />
<h:commandLink id="btn" value="Print">
<p:printer target="a" />
</h:commandLink>
</h:form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
不幸的是,打印功能不起作用.相反,FireBug控制台显示以下错误:
PrimeFaces未定义
我的 Java Web 应用程序中有一个自定义 404 错误页面。(使用 web.xml 声明)它适用于所有情况。但是,如果 url 模式是这样的:www.mysite.com/admin/cannotfind 自定义错误页面找不到 404 自定义错误页面的图像和 css java 脚本文件。但它适用于像 www.mysite.com/cannotfind 这样的普通 url。任何人都告诉我为什么会出现这种行为。
这是我的错误页面配置
<error-page>
<error-code>404</error-code>
<location>/error_pages/error_404.jsp</location>
Run Code Online (Sandbox Code Playgroud)
tx :)
我正在尝试使用primefaces创建带有标签的动态输入文本字段.
就像我点击添加按钮一样,它应该继续添加标签和输入文本字段.
我可以用什么组件?谢谢.
我正在尝试使用 p:ajax 从 h:selectOneMenu 的变化中获取值。但我总是得到空值,不知道下面的代码有什么问题。
<h:form>
<h:selectOneMenu id="selectMenu" value="#{userHomeController.gymsSelectType}">
<f:selectItem itemLabel="Close to me" itemValue="closest" />
<f:selectItem itemLabel="Visited by me" itemValue="visited" />
<p:ajax process="selectMenu" listener="#{userHomeController.selectMenuListener}" event="change" update=":home-form:panel" />
</h:selectOneMenu>
</h:form>
Run Code Online (Sandbox Code Playgroud)
而bean类是
public void selectMenuListener() {
System.out.println("-------- >> " + gymsSelectType); // here null coming
if (gymsSelectType.equals("a")) {
//
} else {
//
}
}
Run Code Online (Sandbox Code Playgroud)
这是一个视图范围的类。变量gymsSelectType 的setter 也打印为null
public void setGymsSelectType(String gymsSelectType) {
System.out.println("------------ >> "+gymsSelectType);
this.gymsSelectType = gymsSelectType;
}
Run Code Online (Sandbox Code Playgroud)