JSF之获取link的值

<p:commandLink id="linkContractId" value="#{result.contractId}"
							onclick="dlg2.show();"
							style="color: blue;text-decoration :underline"
							actionListener="#{searchContractByLessorBean.linkClick}"
							update="contractDialogId">
							<f:param value="#{result.contractId}" name="contractId"></f:param>
						</p:commandLink>


	public void linkClick(ActionEvent e) {
//		CommandLink link =  e.getComponent();
//       String Value = (String) link.getValue();
//       System.out.println("linkValue -------:"+ Value);
		String value = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("contractId").toString(); 
		System.out.println("value:" + value);
		for (SearchContractByLessorResult sr: contractModel) {
			if (sr!= null && value != null && sr.getContractId()!= null
					&& sr.getContractId().trim().equals(value.trim())){
				selectContract = sr;
				System.out.println("-----existing-----");
			}
		}
	}

你可能感兴趣的:(link)