JSF 标签commandlink失效 commandlink总是 会失效,我没有用dataTable,而commandButton不能传参,大家有没有好的建议呀,烦呀。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用f:param传递参数给后台,这样,你就能在函数里获取参数但注意f:param只能对commandLink起作用, 用f:attribute比较好 例子如下: <h:commandButton value="Press here" actionListener="#{myBean.action}"> <f:attribute name="attrname1" value="attrvalue1" /> <f:attribute name="attrname2" value="attrvalue2" /> ... </h:commandButton> public void action(ActionEvent event) { String attrvalue1 = (String) event.getComponent().getAttributes().get("attrname1"); String attrvalue2 = (String) event.getComponent().getAttributes().get("attrname2"); ... }f:attribute还有个注意点就是别使用标准的组件属性名 比如:id,name,binding等等,会有冲突 commandlink总是 会失效 //为什么会失效? 传参不进去?页面报JS错误? 是使用<a4j: commandlink/> 还是<h: commandlink/> ? 建议你就用<h: commandlink/>列如:<h:commandLink id="button" action="#{你的Bean.你的方法}" value="提 交"><f:param name="id111" value="#{你的Bean.你要传到Bean里面的值}" id="aa"/></h:commandLink>commandButton不能传参,大家有没有好的建议呀 //是使用<a4j: commandButton/>还是<h: commandButton/>?<a4j: commandButton/> 只会局部刷新提交,是指定区域的<h: commandButton/> 会提交你所在的当前<h:form>表单的所有内容。 建议你用这个 崩溃的404 求指教 能查出结果就是不返回success Calendar 类型的数据在jsp中显示的问题 求助:spring3+hibernate注解dao为null 简单问题,求个正规解法!!! log4j怎样才能不记录hibernate的加载日志? spring有哪些好处和坏处 java2000_net 请问有没有用spring+hibernate的好的开源项目可下载的. TomCat数据源配置失败 几十万条记录的查询,使用EJB,分页模式的讨论 我不想用记事本编了!给我一个好一点的编Java程序的软件好吗? 一个csv数据转化的问题 SmartUpload 取隐藏域的值
但注意f:param只能对commandLink起作用,
用f:attribute比较好
例子如下:
<h:commandButton value="Press here" actionListener="#{myBean.action}">
<f:attribute name="attrname1" value="attrvalue1" />
<f:attribute name="attrname2" value="attrvalue2" />
...
</h:commandButton> public void action(ActionEvent event)
{
String attrvalue1 = (String) event.getComponent().getAttributes().get("attrname1");
String attrvalue2 = (String) event.getComponent().getAttributes().get("attrname2");
...
}
f:attribute还有个注意点就是别使用标准的组件属性名
比如:id,name,binding等等,会有冲突
建议你就用<h: commandlink/>
列如:
<h:commandLink id="button"
action="#{你的Bean.你的方法}" value="提 交">
<f:param name="id111" value="#{你的Bean.你要传到Bean里面的值}" id="aa"/>
</h:commandLink>
commandButton不能传参,大家有没有好的建议呀 //是使用<a4j: commandButton/>还是<h: commandButton/>?
<a4j: commandButton/> 只会局部刷新提交,是指定区域的
<h: commandButton/> 会提交你所在的当前<h:form>表单的所有内容。 建议你用这个