我正在将旧的JSF应用程序从WebSphere迁移到JBoss:旧版本使用IBM的JSF实现.我的问题涉及以下组件:
<hx:scriptCollector id="aScriptCollector"
preRender="#{aBean.onPageLoadBegin}" postRender="#{aBean.onPageLoadEnd}">
Run Code Online (Sandbox Code Playgroud)
要在JSF 2中重现preRender行为,我使用表单的绑定(此处为s.).我的问题:
1)你知道在JSF 2中模拟postRender的技巧吗?
2)你认为我正在使用preRender"干净"的技巧吗?
非常感谢你的帮助!再见
应用程序通过读取jsf形式的参数来发送信件。我不明白为什么以及如何修复它,因为当您从开发环境运行时,一切正常。当我将应用程序放在 VPS 服务器上时,我收到下一个错误堆栈(尽管应用程序根据需要在本地主机上运行):
StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NoSuchMethodError: sun.security.ssl.SSLSessionImpl.<init>(Lsun/security/ssl/ProtocolVersion;Lsun/security/ssl/CipherSuite;Ljava/util/Collection;Lsun/security/ssl/SessionId;Ljava/lang/String;I)V
at sun.security.ssl.ClientHandshaker.serverHello(ClientHandshaker.java:709)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:984)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:919)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:619)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:393)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2160)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:726)
at javax.mail.Service.connect(Service.java:366)
at org.spirtus.controllers.CustomMailSenderController.sendfromFixedMail(CustomMailSenderController.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.el.ELUtil.invokeMethod(ELUtil.java:304)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:535)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:256)
at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) …Run Code Online (Sandbox Code Playgroud)我有一个selectItem值和标签列表.数据从数据库中获取,selectItem列表具有以下值:
<1,100-500>
<2,1000-1500>
<3,500-1000>
Run Code Online (Sandbox Code Playgroud)
这里1,2,3是selectItem列表的值,'100-500','1000-1500'和'500-1000'分别是标签.如您所见,列表已根据标签进行排序.但我的要求是列表应显示在下拉列表中,如下所示:
100-500
500-1000
1000-1500
Run Code Online (Sandbox Code Playgroud)
有人可以建议一个解决方案?
PrimeFaces 提供了大量来自 jQuery themeroller 的图标。它们很有用,但我需要为我的应用程序定制一些图标。假设我有一个<p:commandButton>:
<p:commandButton icon="ui-icon ui-icon-check" />
Run Code Online (Sandbox Code Playgroud)
由于我的 CSS 知识非常有限,如果您能告诉我如何将一些自定义图标放入上述按钮的标签中,我将不胜感激。
此致,
我有一个<ui:repeat>迭代a List<String>并<p:commandButton>使用当前String的值创建一个<p:lightBox>.
但是当我添加widgetVar到我<p:lightBox>的属性时,它的值<p:commandButton>始终是最后一次迭代的String.
有人可以解释发生了什么,并(我需要widgetVar)可能指出一个解决方案?
这是我的HTML:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head />
<h:body>
<ui:repeat var="thing" value="#{bugBean.things}">
<p:lightBox widgetVar="whatever">
<h:outputLink>
<h:outputText value="#{thing}" />
</h:outputLink>
<f:facet name="inline">
<h:form>
<p:commandButton action="#{bugBean.writeThing(thing)}"
value="#{thing}" />
</h:form>
</f:facet>
</p:lightBox>
</ui:repeat>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是支持bean:
package huhu.main.managebean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class BugBean implements Serializable {
private static final long serialVersionUID = 1L; …Run Code Online (Sandbox Code Playgroud) 如果用户选择一行,我想直接获取dataTable的选定行.
我已经添加了
<p:dataTable id="dataTableID" var="row"
value="#{bean.value}"
rowKey="${row.id}"
selection="#{bean.selectedValue}" selectionMode="single">
Run Code Online (Sandbox Code Playgroud)
点击一个按钮就可以获得它.
当我使用PrimeFaces时 p:commandButton
<p:commandButton action=#{bean.action} />
Run Code Online (Sandbox Code Playgroud)
我没有看到输入的验证消息(默认消息h:或PrimeFaces 消息p:).例如
<f:validateRequired />
Run Code Online (Sandbox Code Playgroud)
当我使用默认命令按钮时
<h:commandButton action=#{bean.action} />
Run Code Online (Sandbox Code Playgroud)
我确实看到了验证.造成这种差异的原因是什么?
我正在使用Prime Faces 3.5和Mojarra 2.1.18
<h:form id="reliefhourheadcopy-form">
<h:panelGrid columns="1">
<h:outputText value="Kopiere Entlastungsstunden von" />
<h:outputText value="Semester: #{reliefHourHeadManagedBean.reliefHourHead.semester}" />
<h:outputText value="Jahr: #{reliefHourHeadManagedBean.reliefHourHead.year}" />
<h:outputText value="nach" />
</h:panelGrid>
<h:panelGrid columns="3">
<h:outputText value="Semester:" />
<p:selectOneMenu id="semester" value="#{reliefHourHeadManagedBean.semester}">
<f:selectItems value="#{reliefHourHeadManagedBean.semesterTypes}" />
</p:selectOneMenu>
<h:message for="semester" />
<h:outputText for="yearSpinner" value="Jahr:" />
<p:spinner id="yearSpinner" value="#{reliefHourHeadManagedBean.year}" maxlength="4" min="2000" max="2030" size="4">
<f:validateRequired />
<f:validateLongRange minimum="2000" maximum="2030" />
</p:spinner>
<h:message for="yearSpinner" />
</h:panelGrid> …Run Code Online (Sandbox Code Playgroud) 我有两个输入的表单,其中一个值取决于另一个.当用户更改一个字段时,我需要重新计算值(这在setter方法中完成)并更新表单.
这是我的例子:
<h:form>
<p:inputText id="price1" value="#{bean.price1}"}">
<p:ajax event="blur" update="@this, price2"/>
</p:inputText>
<p:inputText id="price2" value="#{bean.price2}">
<p:ajax event="blur" update="@this, price1"/>
</p:inputText>
</h:form>
Run Code Online (Sandbox Code Playgroud)
问题是更新后焦点丢失,例如,如果用户使用Tab键从price1移动到price2.
我尝试这样做,但我从来没有得到它的工作;为什么不支持ajax?
<p:commandButton value="MAJ" rendered="#{LigneXL.resultat eq 'Pas de FMD'}" onclick="confirmation.show()" >
<f:setPropertyActionListener target="#{parserXls.selectitem}" value="#{LigneXL}" />
<p:ajax event="click" listener="#{parserXls.listenercomposant()}"/>
</p:commandButton>
Run Code Online (Sandbox Code Playgroud)
监听器永远不会执行为什么!!! 我试图根据selectitem获得另一个对象
public void listenercomposant(){
composantitem=ChercherComposant(selcetitem.getRefcomposant(), selcetitem.getReffabricant());
}
Run Code Online (Sandbox Code Playgroud) 我有一个<h:outputText value="#{xx.nameame}" />在下面给出
<p:dataTable>
<p:column width="200" >
<f:facet name="header" >
<h:outputText value="Header1" />
</f:facet>
<h:panelGroup rendered="#{xx.addFlag == false}">
<h:outputText value="#{xx.nameame}" />
</h:panelGroup>
</p:column>
</p:dataTable>
Run Code Online (Sandbox Code Playgroud)
我想<h:outputText value="#{xx.nameame}" />在单元格示例的左侧对齐此字段的值:text-align:left
但问题是JSF本身,将列视为div标签,默认情况下分配css,即:
.ui-dt-c {
white-space: normal;
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
由于上述原因,文本对齐中心.如果我将上述内容更改为text-align: to left,则所有数据表也将在其他屏幕中更改.
因此,我想将更改仅应用于上述数据表而不是其他数据表.
我怎样才能实现它?
primefaces ×7
jsf ×6
jsf-2 ×3
css ×2
java ×2
ajax ×1
datatable ×1
icons ×1
jakarta-ee ×1
java-8 ×1
javascript ×1
jquery ×1
styling ×1
websphere ×1