相关疑难解决方法(0)

action和actionListener之间的差异

是什么区别actionactionListener,什么时候应该使用actionactionListener

jsf action actionlistener jsf-2

385
推荐指数
3
解决办法
25万
查看次数

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

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

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

jsf action commandlink jsf-2 commandbutton

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

javax.servlet.ServletException:HV000030:找不到类型的验证程序:java.lang.Integer

我必须更新数据库中的信息.

FacadePatient.java 班级代码:

public Patient update(Patient p) {

    Patient pat = em.find(Patient.class, p.getPatientId());
    p.setPatientPhone(pat.getPatientPhone());
    p.setPatientDateNaiss(pat.getPatientDateNaiss());
    p.setPatientEmail(pat.getPatientEmail());
    p.setPatientJob(pat.getPatientJob());
    p.setPatientSmoking(pat.getPatientSmoking());
    p.setPatientSize(pat.getPatientSize());
    em.merge(pat);
    return p;
}
Run Code Online (Sandbox Code Playgroud)

java-ee hibernate-validator bean-validation

32
推荐指数
2
解决办法
7万
查看次数

java.lang.IllegalStateException:CDATA标记可能无法嵌套

我在JSF页面中遇到了ajax请求的问题.当我点击按钮时,我得到以下异常:

SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: CDATA tags may not nest
    at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.startCDATA(HtmlResponseWriter.java:630)
    at javax.faces.context.ResponseWriterWrapper.startCDATA(ResponseWriterWrapper.java:172)
    at javax.faces.context.PartialResponseWriter.startError(PartialResponseWriter.java:342)
    at org.primefaces.context.PrimePartialResponseWriter.startError(PrimePartialResponseWriter.java:210)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:200)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:123)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
Run Code Online (Sandbox Code Playgroud)

我认为这是String对象的一些问题,因为当我对网站上显示的JPA实体属性进行硬编码时,一切都还可以.但是,当从数据库(PostgreSQL)中检索实体时,它会抛出上述异常.

JSF代码:

<p:column>
    <f:facet name="header">
        Akcja
    </f:facet>
    <h:commandButton actionListener="#{mBDocumentMigration.actionEdit(object)}" value="Edytuj" rendered="#{mBDocumentMigration.editingObject == null}" >
        <f:ajax render="@form" execute="@form" />
    </h:commandButton>
    <h:commandButton action="#{mBDocumentMigration.actionZapisz}" value="Zapisz" rendered="#{mBDocumentMigration.editingObject != null}" >
    <f:ajax render="@form"  execute="@this" />
    </h:commandButton>
</p:column>
Run Code Online (Sandbox Code Playgroud)

ajax jsf cdata primefaces illegalstateexception

19
推荐指数
1
解决办法
4万
查看次数

会话到期时的授权重定向不适用于提交JSF表单,页面保持不变

我正在使用JSF2.我已经实现了一个自定义面部servlet,如下所示:

public class MyFacesServletWrapper extends MyFacesServlet {
    // ...
}
Run Code Online (Sandbox Code Playgroud)

其中我正在进行一些授权检查并在用户未登录时发送重定向:

public void service(ServletRequest request, ServletResponse response) {
    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse res = (HttpServletResponse) response;

    if (...) {
        String loginURL = req.getContextPath() + "/LoginPage.faces";
        res.sendRedirect(loginURL);
    }
}
Run Code Online (Sandbox Code Playgroud)

这在用户尝试导航到另一个页面时有效.但是,当JSF命令链接/按钮提交JSF表单时,这不起作用.该行sendRedirect()线被击中并执行,没有异常被抛出了,但用户停留在同一页面.基本上,根本没有视觉变化.

为什么这适用于页面导航,而不是表单提交?

java jsf redirect authorization jsf-2

8
推荐指数
1
解决办法
9452
查看次数

为什么FullAjaxExceptionHandler不是简单地执行ExternalContext#redirect()?

在OmniFaces中,FullAjaxExceptionHandler在找到要使用的正确错误页面之后,调用JSF运行时来构建视图并呈现它而不是包含AJAX调用的页面.

为什么这个?恕我直言,只是执行一个ExternalContext#redirect()?有没有具体的理由这样做?

我们正在编写基于FullAjaxExceptionHandler的自己的ExceptionHandler,并希望了解这种设计背后的原因.

ajax jsf redirect omnifaces exceptionhandler

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

XML解析错误:找不到元素位置:http:// localhost:8081/web-app/pages/login.xhtml第1行,第1列:^

我的login.xhtml开头是:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Run Code Online (Sandbox Code Playgroud)

我使用的是Java 8,JSF,Primefaces,Maven,Tomcat8.我认为我的配置有问题,例如servlets和web.xml.

jsf facelets xml-parsing

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

在基于JSF的应用程序中捕获并记录/通知未处理的异常

我想使用log4j检查并记录我的JSF Web应用程序中的所有未处理的异常.我使用log4j阅读了这篇文章中的日志运行时异常,并添加了一个实现的类Thread.UncaughtExceptionHandler.但是方法没有解雇.

实现这一目标的正确方法是什么?

jsf logging exception-handling

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

异常发生时的JSF响应代码

在我的JSF应用程序中,我java.lang.SecurityException在用户未登录时抛出一个.在web.xml我重定向到login.jsf一个SecurityExceptionocurrs时.

现在我的问题是,当我查看服务器响应时,它是一个500 - Internal Server Error.我可以以某种方式抛出SecurityException并说它应该是一个401

谢谢

jsf jsf-2

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