htmlCommandLink仅适用于第一次

时间:2016-12-12 14:38:37

标签: jsf-1.2

我已经阅读了有关不使用CommandLinks的“所有”其他问题,但没有一个适用于我,希望有另一个解决方案。

我有一个a4j:htmlCommandLink,它只在第一次点击时才有效。 如果我点击页面上触发a4j:outputPanel的reRender的其他位置,那么每次点击它都会有效。

library(ggplot2)
library(ggmap)

df <- data.frame(
id = as.numeric(c(1:18)), 
latitude = as.numeric(c(22.24, 23.20, 24.22, 25.02, 25.88, 26.13, 25.05, 23.93, 22.55, 26.18, 25.45, 24.01, 22.88, 26.13, 25.63, 24.43, 23.41, 26.20)),
longitude = as.numeric(c(-79.68, -79.84, -80.15, -80.01, -80.18, -78.55, -78.37, -78.24, -77.94, -76.13, -76.08, -76.13, -76.11, -75.17, -75.19, -75.29, -75.23, -75.66)))

area1 = get_map(location = c(lon = -77.9407, lat = 24.5774), zoom = 7, maptype = "satellite")

map1 = ggmap(area1, extent = "panel", legend = "bottomright")

map1+geom_point(aes(x = longitude, y = latitude), data = df, color = "#ff0000")

为什么第二次点击(在我做reRender之前)它不起作用?

更新 这有效:

<a4j:outputPanel rendered="true" id="results">
<a4j:form id="csv-form">
<a4j:htmlCommandLink title="Export" action="#{bean.export()}" value="Export CSV" id="csv-link"/>
</a4j:form>
<a4j:form id="other-form">
<a4j:commandLink value="Test" action="#{bean.action()}" reRender="results" title="Test">
</a4j:form>
</a4j:outputPanel>

1 个答案:

答案 0 :(得分:0)

我不知道这是否是JSF 1.2中的错误,但似乎第一次点击htmlCommandLink后a4j:outputPanel没有呈现。

我添加了a4j:支持。在onclick事件中它重新获得结果。我已经更新了上面的代码。

每次单击htmlCommandLink时,都会重新生成“results”outputPanel。它有效。 :)

相关问题