• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display the Map value in JSF button Component

 
Gautam Ry
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am new in JSF. I need to display the Map value in JSF button. My code is below.

JSF code
==============
<h:form id="contactcenterPr_form">
<h:dataTable border='1' value="#{ccSearchAndCaseProcessMB.processForOutBound}" var='var1' id="datatable1">
<h:column>

<h:commandButton type="button" id="hdngo1"
onclick="javascript:changeValue1('#{var1.key}');"
value=""#{var1.value}" styleClass="subBtn" />
</h:column>
</h:form>

MBean
==========
public class ContCenterSearchAndCaseProcessMBean {
public Map getProcessForOutBound(){
Map map=new HashMap();
map.put("22675","Claims");
map.put("12345","Renewal");
map.put("67890","Query");
map.put("27875","Process");
return map;
}
}

So, as per the above code I should be able to see four buttons as 'Claims' ,'Renewal','Query','Process' .
And I need to pass the key as a parameter in JavaScript method.

But , I am unable to see any thing.

Please, help me.

Regards
Gautam




 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing that probably isn't helping: DataTables should be working with ordered collections. Otherwise the table wouldn't consistently display the same rows in the same places. A related issue is that while I'm too lazy to RTFM, I don't think there's an iterator available for the HashMap interface. I think you have to get the keySet or valueSet and iterate on that.

The actual EL for retrieving a hashmap property (value) goes like this:


For retrieving a literal key's value:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic