• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

h:commandLink and page Navigation

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am displaying a list with <h atatable>.

The First column has MerchantName.

The merchantName when displayed is a link to MerchantDetails screen.

<h:column>
<f:facet name="header">
<h utputText styleClass="ListHead" value="#{msgs.name}"
id="text1">
</h utputText>
</f:facet>
<h:commandLink styleClass="commandLink" id="link1">
<h utputText value="#{results.merchantName}"></h utputText>
</h:commandLink>

How do I display the merchantName but when clicked pass the merchantNumber to the MerchantDetails page?

I do not see any option to do that using commandlink.

Do I have to stick to <a:href> tag instead???

Any thoughts
 
allen gilbert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry there was a Typo in the query below.

I wanted to ask

" How do I pass the merchantNumber when the Merchantname link is clicked"?
 
allen gilbert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found a solution.

For anybody else who might be having a similar problem use the <f aram> tag to pass parameters.

<h:column>
<f:facet name="header">
<h utputText styleClass="ListHead" value="#{msgs.name}" id="text1"></h utputText>
</f:facet>
<h:commandLink styleClass="commandLink" id="link1" action="#{pc_MerchantSearchResults.followLink}">
<h utputText value="#{results.merchantName}"></h utputText>
<f aram name="merchantNumber" value="12345678"></f aram>
</h:commandLink>
</h:column>

And in the method you can access the parameters as below

public void followLink(){
String columnValue = (String)FacesContext.getCurrentInstance).getExternalContext().getRequestParameterMap().get("merchantNumber");
System.out.println("columnValue = " + columnValue);
}

Hope this helps.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instead of the method to access passed parameter through command link

use #{para.FileNumber}

it is better than using following code

And in the method you can access the parameters as below

public void followLink(){
String columnValue = (String)FacesContext.getCurrentInstance).getExternalContext().getRequestParameterMap().get("merchantNumber");
System.out.println("columnValue = " + columnValue);
}
 
Manish Sridharan
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instead of the method to access passed parameter through command link

use #{param.PARAMATER_NAME}
where param is request level object and it is in built in jsf
it is better than using following code


public void followLink(){
String columnValue = (String)FacesContext.getCurrentInstance).getExternalContext().getRequestParameterMap().get("merchantNumber");
System.out.println("columnValue = " + columnValue);
}


Thanks

Gaurav
 
allen gilbert
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gaurav

Where do u specify the param.PARAMETER_VALUE in jsp ??

Can you use my sample code above and modify it to make understanding better..
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic