相关疑难解决方法(0)

commandButton/commandLink/ajax动作/侦听器方法未调用或输入值未设置/更新

有时,使用时<h:commandLink>,<h:commandButton>或者<f:ajax>,在action,actionListenerlistener与标签相关的方法根本不被调用.或者,bean属性不会使用提交的UIInput值进行更新.

有什么可能的原因和解决方案?

jsf action commandlink jsf-2 commandbutton

332
推荐指数
5
解决办法
20万
查看次数

如何使用PrimeFaces p:fileUpload?从不调用Listener方法或者UploadedFile为null /抛出错误/不可用

我正在尝试使用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 file-upload primefaces jsf-2

98
推荐指数
3
解决办法
14万
查看次数

JQuery与Primefaces冲突?

我在JSF页面的标题中包含了JQuery1.5.在该页面中,已经编码了许多Primefaces组件.在我Jquery.js将页面标题包含在页面的标题之后,一些主要组件就像<p:commandButton>失去了它们的皮肤一样,<p:fileUpload>看起来像普通的JSP <input type="file">并完全失去了它的AJAX功能.

有没有办法安全地使用JQuery和primefaces(没有冲突)?

primefaces jsf-2 jquery-1.5

34
推荐指数
4
解决办法
5万
查看次数

一起使用不同版本的jQuery和jQueryUI

我正在开发一个项目,他们的框架使用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)

jquery jquery-ui

26
推荐指数
1
解决办法
2万
查看次数

如何在PrimeFaces中使用jQuery和jQuery插件

我有一个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>丢失填充,等等.

这是怎么造成的,我该如何解决?

javascript css jquery jsf primefaces

15
推荐指数
1
解决办法
6万
查看次数

在JSF中警告未保存数据的用户

我想在用户点击链接导航离开当前页面之前警告用户表格中未保存的任何数据,而不保存.在JSF中实现此目的的更好方法是什么,以便在所有页面的单个位置完成此检查.任何建议表示赞赏.

jsf

10
推荐指数
2
解决办法
3083
查看次数

PrimeFaces CSS看起来没什么感觉缺失和JS"未捕获参考错误:PrimeFaces未定义"

我正在尝试使用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)

jsf primefaces

5
推荐指数
1
解决办法
2万
查看次数

如何解决与primefaces jquery的冲突

我正在使用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)

javascript jquery jsf primefaces jsf-2

5
推荐指数
1
解决办法
3万
查看次数