- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 <f:setPropertyActionListener>
将属性值设置为目标 bean里面<p:commandLink>
如下。
<h:form id="form" prependId="true">
<p:panel id="dataPanel" closable="false" toggleOrientation="horizontal" toggleable="true" style="border: none; text-align: center;">
<p:dataGrid id="dataGrid" value="#{productDetailsManagedBean}" var="row" rowIndexVar="rowIndex" rows="4" first="0" columns="1" paginator="true" paginatorAlwaysVisible="false" pageLinks="10" lazy="true" rowsPerPageTemplate="5,10,15">
<p:commandLink process="@this">
<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" />
<!--row.subCatName is correctly retrieved here.-->
<f:setPropertyActionListener value="#{row.subCatName}" target="#{productDetailsManagedBean.subCatName}" />
</p:commandLink>
</p:dataGrid>
</p:panel>
</h:form>
对应的JSF托管bean如下。
@ManagedBean
@RequestScoped
public final class ProductDetailsManagedBean extends LazyDataModel<SubCategory>
{
public ProductDetailsManagedBean() {}
@EJB
private final ProductDetailsBeanLocal productService=null;
private String subCatName;
public String getSubCatName() {
return subCatName;
}
public void setSubCatName(String subCatName) {
System.out.println("setSubCatName() called. : "+subCatName); //Never invoked.
this.subCatName = subCatName;
}
//The following methods are not needed to be reviewed.
@Override
public List<SubCategory> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters)
{
int rowCount = productService.rowCount().intValue();
setRowCount(rowCount);
return productService.getList(first, pageSize);
}
}
当 <p:commandLink>
被点击,bean中对应的setter方法setSubCatName(String subCatName)
预计会被调用,但此方法从未被调用,因此 bean 属性 subCatName
永远不会设置一个值。
我在这里忽略了什么?
我使用的是 Mojarra 2.2.5 和 PrimeFaces 4.0。
process
<p:commandLink>
的属性已设置为 @this
.我已经尝试设置 prependId
的 <h:form>
至 false
但这也没有什么不同。
编辑:
当托管 bean 的范围从 @RequestScoped
更改时,这有效至 @ViewScoped
.这应该适用于 @RequestScoped
bean 也。我在这里做错了什么?这是预期的行为吗?
最佳答案
这确实需要一个比请求范围更高的范围才能工作(在这种情况下,至少需要一个 View 范围的 bean)。请see这个答案。
关于jsf - f :setPropertyActionListener inside p:commandLink doesn't set the property value to the target request scoped bean,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22587809/
今天我有一个非常简单的任务需要帮助。首先让我解释一下我的环境。我们正在使用 Java/Hibernate/SEAM/Facelets/JSF/RichFaces 和 A4J 设置..我对此了解不多。
f:param与 h:link 配合使用效果很好,但不是 p:commandLink或 h:commandLink . 例如,我有两页 test_first.xhtml和 test_second.xh
我最近开始做一些JSF工作-在此之前,我一直使用PHP或Python进行Web开发。 当我发现使用h:commandLink标记时,JSF使用HTTP POST进行导航时,我感到有些惊讶。 我一直在使
环境:Tomcat 6、jsf 2.0、prime faces 2.2.1、chrome 浏览器 我想单击左侧伸展树(Splay Tree)中的“查看详细信息”链接并显示产品的详细信息。但下面的代码不
我正在尝试在我的应用程序 (Seam/RichFaces) 中显示购物车,并包含“从购物车中删除”旁边的每个项目以从购物车中删除该项目。当我单击该链接时,它应该重新呈现购物车内容以显示该项目已被删除。
当我创建一个包含分面的复合组件并在该分面内放置一个命令链接时,我收到一条错误消息:This link is disabled as it is not nested within a JSF form
我对 有疑问.我想制作悬停效果,但无法将图像加载到 通过 CSS。 CSS: .accountEditBtn { background-image: url('#{request.c
我是新手,但我的操作没有被触发。在 a4j:commandLink id="linklogout"中,我添加了一个不起作用的新操作 menubean.resetMenuActionVariables
我的树表中有很多命令链接,我动态构建它们,如果我想在单击一个命令链接时更改它的颜色,所有命令链接都会更改它们的颜色,我不知道如何做更改此指定链接的颜色,因为我不知道她的号码或 ID,如果有人知道答案,
我有以下 XHTML: TODO supply a title
我有一个包含两个 JSP 的 JSF 应用程序:login.jsp 和 main.jsp。 我有以下 faces-config.xml: package.programs.scorecard.b
写作能力不足请谅解。 我正在测试制作自定义凭证提供程序。我想创建一个 CommandLink 来对提交按钮做同样的事情。我想通过 CommandLink 与“提交”按钮分开登录。目前,只有自定义凭证提
我正在开发一个 JSF 应用程序并想要一个简单的功能 - 单击命令按钮并显示一个命令链接。我做了一个测试。代码: function testfunc() { docu
我在我的应用程序中使用了 icefaces commandLink,我想在水印中添加一个图标。我在 commandLink 中添加了一个属性 styleCss="disconnect",但在渲染过程中
这是我的代码。我在面板网格内有两个图像,这两个图像放置在动画 Javascript 渐变之上。当左侧图像与右侧的注销图标平行放置时(如图所示),注销功能不起作用。当我删除左侧图像时,注销功能正在运行。
我想知道是否可以将 h:commandLink 嵌套到 h:outputFormat 消息中,例如: 消息.属性 disclaimerLink=Click {0] for Disclaimer 现在我
谁能告诉我如何在 WPF 窗口中添加 CommandLink 控件? 这就是我所说的 CommandLink 的意思:http://msdn.microsoft.com/en-us/library/a
如何使用 commandLink 显示图标: outputText (Add) 不可见。 commandLink 支持图标的正确方法是什么?谢谢。 最佳答案
我在延迟加载 Primefaces Datascroller 时遇到问题成分。 我有一个 jsf 页面,它应该在页面加载时显示 10 个事件。如果用户想要查看更多,他/她可以单击更多按钮加载并显示 1
我想使用我的 faces-config.xml (JSF 2.0) 的导航规则功能,但我遇到了一些问题。我有三个文件(index.xhtml、index2.html、index3.xhtml),它们看
我是一名优秀的程序员,十分优秀!