2013-04-20 70 views
0
<h:commandLink action="http://192.168.2.66:8084/TekirMobile2/customerListDetailed.xhtml" value="#{item.code}" > 
           <h:inputHidden value="#{item.address}" /> 
           <h:inputHidden value="#{item.name}" /> 

          </h:commandLink> 

我有上面的代码。这个代码在customerList.xhtml和用户点击commandLink按钮后,我想将输入隐藏值发送到customerListDetailed.xhtml。我怎样才能做到这一点?发送参数输入类型隐藏值到另一个jsf页面

+1

当时是你的问题了吗? – 2013-04-20 10:10:45

+0

我更新了我的问题 – user2299982 2013-04-20 10:17:25

+0

您在学习JSF时阅读过哪些书籍/教程/资源?你的'action'属性是完全错误的。它必须指向一个后台bean操作方法或一个导航案例结果。首先,您是否成功创建了包含2个页面的Hello World JSF应用程序?例如。猜数字等等?无论如何,在回答您的具体问题之前,我们需要知道这两个页面是否在同一个Web应用程序中运行。 – BalusC 2013-04-21 00:44:53

回答

-1

要做到这一点,您可以在commandLink标签之后编写隐藏标签。请注意,您应该添加上面的代码到H:表单标签

例子:

 <h:form> 
      <h:commandLink 
    action="http://192.168.2.66:8084/TekirMobile2/customerListDetailed.xhtml" 
      value="#{item.code}" >  
      </h:commandLink> 
      <h:inputHidden value="#{item.name}" name="name" id="name" /> 
    <h:inputHidden value="#{item.address}" name="address" id="address" /> 
     </h:form> 

辅助Bean

@ManagedBean(name="item") 
public class Item implements Serializable{ 
    private String code; 
    private String address; 
    private String name; 
    public Item(){ 
     String name= FacesContext.getCurrentInstance(). 
    getExternalContext().getRequestParameterMap().get("name"); 
     String address= FacesContext.getCurrentInstance(). 
    getExternalContext().getRequestParameterMap().get("address"); 
    } 
    //getters and setters 


} 
+0

我如何在其他页面中获得这些值? – user2299982 2013-04-20 10:37:40

+0

@ user229982:http://stackoverflow.com/questions/3351348/get-request-parameter-values-in-jsf – 2013-04-20 10:41:06

+0

我编辑了我的答案 – olyanren 2013-04-20 10:41:17

相关问题