刚开始使用jsf,请教跳转问题,谢谢各位
下面是我遇到的问题
<managed-bean>
<managed-bean-name> custorderDAOImpl </managed-bean-name>
<managed-bean-class> com.cheers.jzth.custorder.CustOrderDAOImpl </managed-bean-class>
<managed-bean-scope> session </managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name> custorderinfDAOImpl </managed-bean-name>
<managed-bean-class> com.cheers.jzth.custorder.CustOrderInfDAOImpl </managed-bean-class>
<managed-bean-scope> session </managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name> CustOrderInf </managed-bean-name>
<managed-bean-class> com.cheers.jzth.custorder.CustOrderInf </managed-bean-class>
<managed-bean-scope> request </managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id> /web/custorder/custorderlist.xhtml </from-view-id>
<navigation-case>
<from-outcome> success </from-outcome>
<to-view-id> /web/custorder/custorderlist.xhtml </to-view-id>
</navigation-case>
<navigation-case>
<from-outcome> detail </from-outcome>
<to-view-id> /web/custorder/custorderdetail.xhtml </to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id> /web/custorder/custorderdetail.xhtml </from-view-id>
<navigation-case>
<from-outcome> orderinfoedit </from-outcome>
<to-view-id> /web/custorder/custorderdetailedit.xhtml </to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id> /web/custorder/custorderdetailedit.xhtml </from-view-id>
<navigation-case>
<from-outcome> success </from-outcome>
<to-view-id> /web/custorder/custorderdetail.xhtml </to-view-id>
</navigation-case>
</navigation-rule>
一开始是一个订单列表,点“详细”可以看到订单的详情,实现如下
<h:commandLink value= "detail " action= "#{custorderDAOImpl.detail} " >
<f:param value= "#{order.id} " name= "orderid " />
</h:commandLink>
String detail()
{
.. 取得订单详细列表,
return "detail "
}
这一步没有问题,然后是在详细列表中有一个“修改”按钮
<h:commandLink value= "edit1 "
action= "#{custorderinfDAOImpl.editorderinfo} " >
<f:param value= "#{order.comp_id.orderid} " name= "orderid " />
<f:param value= "#{order.comp_id.merchid} " name= "merchid " /> </h:commandLink>
String editorderinfo()
{
..得到订单详细记录
return "orderinfoedit ";
}
这一步出现问题,不能跳转到编辑页面,总是回到当前页面,请高手指教,小弟不胜感激!!!!!
[解决办法]
#{order.id} 这个是什么东西?!! EL表达式吗? 不是这样的吧
${order.id} 吧!!!!!!
[解决办法]
关注
[解决办法]
#{order.id}是JSF的EL表达式
效果和${order.id}是一样的
[解决办法]
你查看源文件会发现 <h:commandLink> 都转换成 <a> 这意味着先超级链结而后又会触发onClick事件,将导致数据提交紊乱,使用 <h:commandButton> 就可以了.
[解决办法]
web.xml 里 <param-value> false </param-value> 试试看
<context-param>
<param-name> org.apache.myfaces.AUTO_SCROLL </param-name>
<param-value> false </param-value>
</context-param>