aspose file tools*
The moose likes JSF and the fly likes How to display the Map value in JSF button Component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to display the Map value in JSF button Component" Watch "How to display the Map value in JSF button Component" New topic
Author

How to display the Map value in JSF button Component

Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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:


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display the Map value in JSF button Component