myfaces的form提交问题?求解! Form内只包含一个<h:outputText>显示一条信息,两个<h:commandButton分别表示Yes or No的选择按钮,按钮的action属性都设置成Bean里面的方法,第一次点击按钮的时候页面提交了,但是Bean的方法没有执行,又返回原来的页面了,第二次再点击的时候才执行了Bean方法,请问这是这么回事?为什么要点击两次才起作用? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <f:view> <h:form id="confirmForm"> <t:div styleClass="centerAlign"> <t:panelGrid columns="1" styleClass="loginForm"> <h:outputText value="Are you sure?" /> <t:panelGrid columns="2"> <h:commandButton action="#{sessionBean.logout}" value="Yes" /> <h:commandButton action="cancel" value="No" /> </t:panelGrid> </t:panelGrid> </t:div> </h:form> </f:view> public SessionBean { public String logout() { isLogin = false; return "login"; }} 这很正常,在web.xml里设置 <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value>//设置为客户端,默认为服务器端 </context-param>就可以了. jsp中input的file的value问题 jsp相关的网页词典 Spring java.lang.NullPointerException异常~ 【求正则表达式】 把hibernate3.2中timestamp类型映射成sql中datetime类型,怎样处理? 请教struts2与jsf的区别与联系 jsp连接windows2003数据库问题(求求大家了,在线等) 在函数中的输出问题? 进来找错误 用JSP怎么解决图片上传问题啊 谁能给我一段Struts中,切换多语言的代码? 如何判读访问网站的是移动设备还是计算机,并自动转向???
<h:form id="confirmForm">
<t:div styleClass="centerAlign">
<t:panelGrid columns="1" styleClass="loginForm">
<h:outputText value="Are you sure?" />
<t:panelGrid columns="2">
<h:commandButton action="#{sessionBean.logout}" value="Yes" />
<h:commandButton action="cancel" value="No" />
</t:panelGrid>
</t:panelGrid>
</t:div>
</h:form>
</f:view>
public String logout() {
isLogin = false;
return "login";
}
}
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>//设置为客户端,默认为服务器端
</context-param>
就可以了.