WARNING: FacesMessage(s) have been enqueued, but may not have been displayed

本文探讨了JSF页面Action中出现错误提示的原因,并提出了两种常见解决方案:一是确保页面包含<h:messages>标签以接收FacesMessage;二是确认按钮的Action中有reRender属性指向消息容器。

JSF页面action,后台出现此提示,一般无非2个原因:

1.页面没有<h:messages>标签, FacesMessage没法被页面接收;

2.按钮的action中虽然添加了 FacesMessage,但是按钮本身没有reRender="messageContainer"。

报错<Jul 14, 2025, 5:57:52,087 PM China Standard Time> <Warning> <com.lkm.ejb.dept.ejb.DeptInfoEjb_562xts_Impl> <BEA-000000> <error at saveEventData:IllegalArgumentException: An instance of a null PK has been incorrectly provided for this find operation.> , <p:outputPanel> <h:panelGrid columns="2" styleClass="no-border"> <p:outputPanel style = "display: flex;flex-wrap: wrap;"> <h:panelGrid columns="1" styleClass="no-border"> <h:panelGrid columns="12" responsive="true" styleClass="no-border"> <div class="ui-inputgroup" style="display:inline-block;"> <p:outputLabel value="部门名称" /> <p:inputText id="dept_name" style="width:180px" value="#{departmentBean.department.name}"/> </div> <div class="ui-inputgroup" style="display:inline-block;"> <p:outputLabel value="部门地址" /> <p:inputText id="dept_addr" style="width:180px" value="#{departmentBean.department.addr}"/> </div> <p:commandButton value="提交" rendered="#{departmentBean.preview}" action="#{departmentBean.createDept}" update="@form:dataTableId" oncomplete="if(!args.validationFailed) PF('createDept').hide()" class="query" ajax="true" style="width:80px;" /> </h:panelGrid> </h:panelGrid> </p:outputPanel> </h:panelGrid> </p:outputPanel>, public void createDept() { try { // 从Bean获取表单提交的数据 String name = department.getName(); // 从表单绑定的对象获取 String addr = department.getAddr(); // 保存部门 DeptmentDm deptmentDm = new DeptmentDm(); deptmentDm.setAddr(addr); deptmentDm.setName(name); deptmentDm.setUpdateTime(new Date()); deptmentSerivce.saveEventData(deptmentDm); // department = new DeptmentQuery(); // 重置表单 // departments = null; // 强制刷新列表 FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "成功", "部门创建成功"); FacesContext.getCurrentInstance().addMessage(null, message); } catch (Exception e) { // 显示错误消息 FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "错误", "创建部门失败: " + e.getMessage()); FacesContext.getCurrentInstance().addMessage(null, message); } }
07-15
<Aug 22, 2025, 4:50:25,357 PM China Standard Time> <Error> <org.primefaces.application.exceptionhandler.PrimeExceptionHandler> <BEA-000000> <The class 'com.lkm.bean.AppealBeanV3' does not have the property 'isSpecialApproval'. javax.el.PropertyNotFoundException: The class 'com.lkm.bean.AppealBeanV3' does not have the property 'isSpecialApproval'. at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:646) at javax.el.BeanELResolver.getValue(BeanELResolver.java:309) at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156) at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184) at com.sun.el.parser.AstValue.getValue(AstValue.java:115) Truncated. see log file for complete stacktrace > Aug 22, 2025 4:50:25 PM org.primefaces.application.exceptionhandler.PrimeExceptionHandler handle SEVERE: Could not handle exception! java.lang.IllegalStateException: Cannot resize buffer - 63560 bytes have already been written (Servlet 2.3, sec. 5.1) at weblogic.servlet.internal.ServletResponseImpl.setBufferSize(ServletResponseImpl.java:415) at com.sun.faces.context.ExternalContextImpl.setResponseBufferSize(ExternalContextImpl.java:974) at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.<init>(PartialViewContextImpl.java:664) at com.sun.faces.context.PartialViewContextImpl.getPartialResponseWriter(PartialViewContextImpl.java:343) at org.primefaces.context.PrimePartialViewContext.getPartialResponseWriter(PrimePartialViewContext.java:68) at org.primefaces.application.exceptionhandler.PrimeExceptionHandler.handleRedirect(PrimeExceptionHandler.java:354) at com.lkm.pmi.mainvc.LkmExceptionHandler.handleRedirect(LkmExceptionHandler.java:67) at org.primefaces.application.exceptionhandler.PrimeExceptionHandler.handle(PrimeExceptionHandler.java:100) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:94) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199) at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:82) at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:81) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:82) at com.lkm.pmi.template.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:21) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:82) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:82) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3866) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3829) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344) at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) at weblogic.servlet.internal.WebAppServletContext.processSecuredExecute(WebAppServletContext.java:2502) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2351) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2326) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2304) at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1779) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1733) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272) at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352) at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337) at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57) at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:651) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420) at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)
最新发布
08-23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值