I am passing a value to the controller class through commandLink tag(below is the code). First of all I am retrieving few records as tabledata and then while click on the ID, it will navigate to another page to show the details. But in this case the parameter value is not being passed to the controller for the very first time. In the controller I am getting null due to which it fails to load the data.
I've gone through a link which says it is a bug in the JSF 1.X (see the point-10 in below link). i need to fix this with commandLink tag only.
The code works fine in another functionality using the same commandLink tag but i do not understand why is it not working in this scenario. Below are the not working and working code.
Not working:
JSP:
<hx:columnEx id = "columnRequestID">
<f:facet name = "header">
<hx:sortHeader styleClass = "sortHeader" id = "sortRequestID"
defaultSortOrder = "sortbi">
<h:outputText id = "outputTxtRequestID" styleClass = "outputText sortOverlap"
value = "#{pc_Controller.propertiesMap.txtRequestID}"/> </hx:sortHeader> </f:facet>
<h:commandLink styleClass = "outputLinkEx" id = "lnKrequestID"
value = "#{searchResult.requestID}" actionListener = "#{pc_Controller.handleActionEvent}"
action = "#{pc_Controller.processRCAction}">
<f:param value = "#{searchResult.requestID}"
name = "paramRequestID"/>
</h:commandLink> </hx:columnEx>
Controller:
if("lnKrequestID".equals(action)){
if (request.getParameter("paramSCRequestID") != null) { // This is not
really null but but an empty value
String reqID = request.getParameter("paramSCRequestID"); // Here no value
Working:
</f:facet>
<h:commandLink styleClass = "outputLinkEx" id = "lnKrequestID"
value = "#{reportResult.requestID}"
action = "#{pc_Controller.processRCAction}" actionListener = "#{pc_Controller.handleActionEvent}">
<f:param value = "#{reportResult.requestID}"
name = "paramRequestID"/>
<f:param value = "#{reportResult.requestType}"
name = "paramRequestType"/>
</h:commandLink>
Controller:
if("lnKrequestID".equals(action)){
if(request.getParameter("paramSetStatusRequestType")!= null ){
String requestId=request.getParameter("paramRequestID"); // Here i am
getting value at all time
//Some code..
}}
Link for previous discussion. commandButton/commandLink/ajax action/listener method not invoked or input value not set/updated