将参数输入类型隐藏值发送到另一个jsf页面

时间:2013-04-20 09:56:21

标签: java jsf

   <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。我怎么能这样做?

1 个答案:

答案 0 :(得分:-1)

为此,您可以在commandLink标记之后编写隐藏标记。请注意,您应将以上代码添加到h:form tag

示例:

      <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


}