有时,使用时<h:commandLink>,<h:commandButton>或者<f:ajax>,在action,actionListener或listener与标签相关的方法根本不被调用.或者,bean属性不会使用提交的UIInput值进行更新.
有什么可能的原因和解决方案?
我正在尝试使用PrimeFaces上传文件,但fileUploadListener上传完成后不会调用该方法.
这是观点:
<h:form>
<p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
mode="advanced"
update="messages"
sizeLimit="100000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
<p:growl id="messages" showDetail="true"/>
</h:form>
Run Code Online (Sandbox Code Playgroud)
还有豆子:
@ManagedBean
@RequestScoped
public class FileUploadController {
public void handleFileUpload(FileUploadEvent event) {
FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
Run Code Online (Sandbox Code Playgroud)
我已经在方法上放置了一个断点,但它从未调用过.当使用mode="simple"和时ajax="false",它已被调用,但我希望它在高级模式下工作.我正在使用Netbeans和Glassfish 3.1.
我在JSF页面的标题中包含了JQuery1.5.在该页面中,已经编码了许多Primefaces组件.在我Jquery.js将页面标题包含在页面的标题之后,一些主要组件就像<p:commandButton>失去了它们的皮肤一样,<p:fileUpload>看起来像普通的JSP <input type="file">并完全失去了它的AJAX功能.
有没有办法安全地使用JQuery和primefaces(没有冲突)?
我正在开发一个项目,他们的框架使用jQuery 1.3.2和jQueryUI 1.7.2.
升级框架中的版本是不可能的,所以我想并行运行jQuery 1.4.4和jQueryUI 1.8.5.
我已经看到不同版本的jQuery可以并行使用,如下所示:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
var j$132 = $.noConflict(true);
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript">
var j$144 = $.noConflict(true);
</script>
Run Code Online (Sandbox Code Playgroud)
但这也适用于以下情况:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
var j$132 = $.noConflict(true);
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
<script type="text/javascript">
var j$144 = $.noConflict(true);
</script>
Run Code Online (Sandbox Code Playgroud) 我有一个PrimeFaces Web应用程序.当我手动添加如下所示的jQuery和插件时,
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/onebyone/jquery.onebyone.js"></script>
<script type="text/javascript" src="js/onebyone/jquery.touchwipe.min.js"></script>
<script type="text/javascript" src="js/jquery.carouFredSel-5.5.0.js"></script>
Run Code Online (Sandbox Code Playgroud)
然后PrimeFaces组件失去了他们的功能和一些他们的风格.例如,<p:dialog>不显示,<p:accordionPanel>不滑动,<p:panelGrid>丢失填充,等等.
这是怎么造成的,我该如何解决?
我想在用户点击链接导航离开当前页面之前警告用户表格中未保存的任何数据,而不保存.在JSF中实现此目的的更好方法是什么,以便在所有页面的单个位置完成此检查.任何建议表示赞赏.
我正在尝试使用Primefaces的Picklist.呈现页面时,Chrome中的javascript引擎无法找到Primefaces对象.我收到以下错误'Uncaught ReferenceError:PrimeFaces未定义'.我错过了在我的.xhtml文件中包含任何资源(js)吗?请指教.谢谢.
XHTML
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<link rel="stylesheet" type="text/css"
href="../jquery-ui-1.8.23.custom/css/ui-lightness/jquery-ui-1.8.23.custom.css" />
<link rel="stylesheet" type="text/css" href="css/form.css" media="all" />
<script src="../jquery-ui-1.8.23.custom/js/jquery-1.8.0.min.js"></script>
<script
src="../jquery-ui-1.8.23.custom/js/jquery-ui-1.8.23.custom.min.js"></script>
</head>
<h:body>
<form id="form_486588" class="appnitro" method="post">
<div class="form_description"></div>
<p:pickList id="pickList" value="#{editorsMB.editors}" var="editor"
itemLabel="#{editor}" itemValue="#{editor}" />
<p:commandButton id="citySubmit" value="Submit"
style="margin-top:5px" />
</form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
管理豆
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.primefaces.model.DualListModel;
@ManagedBean(name = "editorsMB")
@SessionScoped
public class AdminEditorsBean { …Run Code Online (Sandbox Code Playgroud) 我正在使用primefaces 5开发一个项目,一个页面使用需要jquery的js文件,但显示Uncaught TypeError: undefined is not a function,但当我将我的jquery源更改<h:outputScript library="primefaces" name="jquery/jquery.js" target="head"/>为
<h:head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
</h:head>
Run Code Online (Sandbox Code Playgroud)
工作正常,但我失去了许多主要功能,如 contexMenu
我该如何解决这个冲突?
这是我的javascript文件:
(function($, $S) {
//$ jQuery
//$S window.localStorage
//Variables Declaration
var $board = $('#notesForm\\:board'),
//Board where the Posticks are sticked
Postick, //Singleton Object containing the Functions to work with the LocalStorage
len = 0, //Length of Objects in the LocalStorage
currentNotes = '', //Storage the html construction of the posticks
o; //Actual Postick data …Run Code Online (Sandbox Code Playgroud) jsf ×6
primefaces ×5
jsf-2 ×4
jquery ×3
javascript ×2
action ×1
commandlink ×1
css ×1
file-upload ×1
jquery-1.5 ×1
jquery-ui ×1