我最近开始做一些JSF工作 - 在此之前我总是使用PHP或Python进行Web开发.
当使用h:commandLink标记时,我发现JSF使用HTTP POST进行导航,我感到有些惊讶.
我一直在使用commandLink,因为这显然是构建JSF应用程序的正确方法.为什么JSF使用POST进行导航?GET有什么问题?我只能假设JSF为onclick事件自动生成的Javascript可能超过GET请求的最大长度.
我已经有很多使用h:commandLink导航的页面.这很好用,直到我使用浏览器的后退按钮.我该如何处理JSF中的后退按钮?
我很难理解为什么JSF是围绕POST构建的.它打破了书签,反向分页以及将您的页面编入索引的功能.
有人能告诉我如何在WPF窗口中添加CommandLink控件吗?
这就是CommandLink的意思:http://msdn.microsoft.com/en-us/library/aa511455.aspx
我似乎遇到一个问题,我在rich:popupPanel上有一个a4j:commandLink,但是没有触发动作.xhtml看起来如下:
<rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal">
/**Some html here**/
<a4j:commandLink immediate="false" action="#{venueScore.up}" render="rate-panel" styleClass="rate love">
<span>Love it</span>
</a4j:commandLink>
/**Some more html here**/
</rich:popupPanel>
Run Code Online (Sandbox Code Playgroud)
托管bean看起来如下:
@Named("venueScore")
@ViewScoped
public class VenueScoreManager extends BaseManager implements Serializable {
public void up() {
System.out.println("TEST");
//Do something
}
}
Run Code Online (Sandbox Code Playgroud)
我已经创建了托管bean @ViewScoped.
我也试过<h:form>在commandLink周围添加一个,但是,这比没有它更少.我实际上认为这是因为commandLink <h:form>位于打开popupPanel的链接所在的位置.
无论如何,有人可以指点我为什么行动不开火?
我试图执行一个action通过commandButton内部的dataTable,但action在时不调用commandButton被放置在数据表中,如下图所示
<h:form>
<h:dataTable value="#{bean.list}" var="item">
<h:column>
<h:commandButton value="submit" action="#{bean.submit}" />
</h:column>
</h:dataTable>
</h:form>
Run Code Online (Sandbox Code Playgroud)
当我commandButton移出时dataTable,action成功执行.数据表内部有什么问题commandButton?该commandLink有同样的问题.
我在JSF页面中有以下内容:
<h:commandLink action="#{manager.removeEntity(row.id)}" value="Remove">
<f:ajax event="action" render=":form:table" />
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
渲染工作完美,但在执行操作之前渲染组件.(我通过记录知道这一点)
在服务器上执行动作功能后,有什么方法可以渲染组件吗?
任何帮助将不胜感激
更新1
我删除了action属性并为标记添加了一个监听器,但不幸的是它似乎没有帮助,在渲染组件树之后仍然会调用该方法.
我想通过Facelets的链接调用一个方法:
我的Facelets代码如下:
<h:commandButton value="A" actionListener="#{customerData.searchedCustomerListA}" />
<h:commandLink value="A" actionListener="#{customerData.searchedCustomerListA}"/>
Run Code Online (Sandbox Code Playgroud)
支持bean代码如下:
public void searchedCustomerListA(ActionEvent ae){
customerName = "A";
leftCustomerListAvailable.clear();
if(customerDataBean.getSearchedCustomerList(customerName)!= null)
leftCustomerListAvailable =customerDataBean.getSearchedCustomerList("A");
}
Run Code Online (Sandbox Code Playgroud)
相同的代码正在起作用<h:commandButton>但不起作用<h:commandLink>.这是怎么造成的,我该如何解决?
我想将以下标记转换为 JSF h:commandLink,但我在使用 data-toggle 属性时遇到问题。
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Run Code Online (Sandbox Code Playgroud)
这是我把它转换成的:
<h:commandLink styleClass="dropdown-toggle" data-toggle="dropdown">
Run Code Online (Sandbox Code Playgroud)
据我所知,commandLink 被呈现为 HTML 标签。但是重写成JSF后,下拉菜单无法使用。有任何想法吗?
问候,贝杰
有谁知道如何将命令按钮中的相同样式添加到所有命令链接?
我希望所有链接都显示为这样(覆盖链接样式和使用按钮样式):
一个普通的按钮:

悬停按钮:

按下按钮:

我目前的主题是开始
当我创建一个包含构面的复合组件并将命令链接放置在该构面中时,出现错误消息: This link is disabled as it is not nested within a JSF form.
commandButton的行为方式不同,所以我倾向于这是一个错误。
index.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">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:mycomp="http://xmlns.jcp.org/jsf/composite/mycomp"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
</h:head>
<h:body>
<mycomp:component>
<f:facet name="someFacet">
<h:commandLink value="this link should work, but does not (within form, within facet)"/><br/>
<h:commandButton value="this button works as expected (within form, within facet)"/><br/>
</f:facet>
</mycomp:component>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
/resources/mycomp/component.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<ui:component
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
>
<cc:interface>
<cc:facet …Run Code Online (Sandbox Code Playgroud) 我们正在从JSF 1.2迁移到JSF 2.2.6以及RichFaces 4.5.2.面对oncomplete未被调用的问题.在onclick调用JS函数时,JS函数oncomplete不会被调用.这是怎么造成的,我该如何解决?
<h:commandLink ... onclick="ed();" oncomplete="cEd(#{rowIndex});">
Run Code Online (Sandbox Code Playgroud)