两人之间JSF意见xhtmls(两者都具有视图范围的支持bean)我想传递参数,如果用户点击一个链接或按钮。如果我有一个属性用JavaScript函数打开另一个页面的onclick(在本页面我想用在第一页设置参数)到命令或commandLink我得到的f:param
属性是\'currentAccess\':\'3\',\'gridNo\':\'5\',
,如果我不有一个onclick属性我是不是正确的'currentAccess':'3','gridNo':'5',
如果我有:的commandButton设置不正确F:PARAM,如果它得到了在onclick事件JavaScript方法
<h:commandButton action="#{statisticsBean.showAccessIncorectAnswers()}" target="_blank"
value="#{strings.whatHaveDoDoneWrong}" rendered="#{o.date != '-' and o.answerNoWrong != 0}">
<f:param name="currentAccess" value="#{o.currentAccess}"/>
<f:param name="gridNo" value="#{o.noGrid}"/>
<f:param name="gridCategory" value="#{o.category}"/>
</h:commandButton>
HTML呈现的样子:
<input type="submit" name="j_idt73:0:j_idt74:j_idt77" value="Ce ai gresit" onclick="mojarra.jsfcljs(document.getElementById('j_idt73:0:j_idt74'),{'j_idt73:0:j_idt74:j_idt77':'j_idt73:0:j_idt74:j_idt77','currentAccess':'1','gridNo':'5','gridCategory':'Drept Procesual Civil'},'');return false" />
这是很好的,我有机会获得参数(F:viewpara或FacesContext中,我使用最后一个像FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("currentAccess")
)
但 如果我有:
<h:commandButton action="#{statisticsBean.showAccessIncorectAnswers()}" target="_blank"
onclick="confirmGridStatistics('#{strings.doYouWantToSeeTheWrongAnswersInAccessNo} #{o.currentAccess} #{strings.fromDate} #{o.date}?');"
value="#{strings.whatHaveDoDoneWrong}" rendered="#{o.date != '-' and o.answerNoWrong != 0}">
<f:param name="currentAccess" value="#{o.currentAccess}"/>
<f:param name="gridNo" value="#{o.noGrid}"/>
<f:param name="gridCategory" value="#{o.category}"/>
</h:commandButton>
在onclick事件的JavaScript函数
我得到的渲染:
<input type="submit" name="j_idt73:2:j_idt74:j_idt77" value="Ce ai gresit" onclick="jsf.util.chain(this,event,'confirmGridStatistics(\'Vrei sa vezi raspunsurile gresite in accessul 3 din data de 16-05-2013?\');','mojarra.jsfcljs(document.getElementById(\'j_idt73:2:j_idt74\'),{\'j_idt73:2:j_idt74:j_idt77\':\'j_idt73:2:j_idt74:j_idt77\',\'currentAccess\':\'3\',\'gridNo\':\'5\',\'gridCategory\':\'Drept Procesual Civil\'},\'\')');return false" />
,并在第二个意见支持豆我得到null
为来自FacesContext的参数。这是为什么?
UPDATE 我认为
的操作方法FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().put("currentAccess", access);
解决对子级它。但它没有,它给了我一个java.lang.UnsupportedOperationException
我不知道为什么会这样。