aspose file tools*
The moose likes JSF and the fly likes setting up hashmap key in t:SelectBooleanCheckbox in a dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "setting up hashmap key in t:SelectBooleanCheckbox in a dataTable" Watch "setting up hashmap key in t:SelectBooleanCheckbox in a dataTable" New topic
Author

setting up hashmap key in t:SelectBooleanCheckbox in a dataTable

vishnu bola
Ranch Hand

Joined: Jun 01, 2009
Posts: 32
Hi all,

iam new to JSF and have a problem with my t:SelectBooleanCheckbox tag.

In my dataTable there is a column
<t:column>
<t:selectBooleanCheckbox id="checkbox4" value="#{manageuserscontroller.selectedUserIds[user.id-cols.accountID]}" />
</t:column>

the key is a string with a combination of userID and accountID with hyphen(-) in the middle. eg:"123-456" Iam not sure how to dynamically populate the key in my dataTable column. Please advise.

I already posted this query in sun forums http://forums.sun.com/thread.jspa?threadID=5415508 but didn't get a response.So iam reposting the query here. Please advise.
Mallika gowd
Greenhorn

Joined: Sep 28, 2009
Posts: 26
post your code and mention details clearly..please
vishnu bola
Ranch Hand

Joined: Jun 01, 2009
Posts: 32
Hi mallika,

Iam happy to see some response. Ok let me copy my entire code below. I have dataTable :
<h:form id="groupuserlist">
<t:dataTable id="groupuserlist"
var="user"
value="#{manageuserscontroller.userList}"
binding="#{manageuserscontroller.userTable}"
styleClass=" marVertSml"
cellspacing="0"
preserveDataModel="false"
headerClass="topRow"
summary="This table displays list of users for an accessgroup">
<t:column>

<f:facet name="header"><hutputText value="User ID" /></f:facet>

<tutputText value="#{user.ID}" />
</t:column>
<t:column>

<f:facet name="header"><t:commandLink value="Title" /></f:facet>

<tutputText value="#{user.title}" />

</t:column>
<t:columns var="cols" value="#{manageuserscontroller.selectedAGList}">
<f:facet name="header"><hutputText value="#{cols.name}" /></f:facet>



<t:selectBooleanCheckbox id="checkbox4" value="#{manageuserscontroller.selectedUserIds[user.ID-cols.accountID]}" />

</t:columns>

In my backing bean ManageUsersController I have hashmap
private Map<String, Boolean> selectedUserIds = new HashMap<String, Boolean>();

This hashmap get populated from the database and the data in it is something like
("123-456",true) where 123 is the userID and 456-accountID.

Now this key acts as checkbox value in my dataTable. Now my problem is iam not able to construct the key inside EL in this format. Kindly need help.





Mallika gowd
Greenhorn

Joined: Sep 28, 2009
Posts: 26
Hi,

you have selected items in backing bean so concatenate two of them pass it as a string.

If you still not understand this logic..please paste your backing bean code so i can suggest.
vishnu bola
Ranch Hand

Joined: Jun 01, 2009
Posts: 32
Hi Mallika i am not really clear on what you mean by concatenation. Here is my backing bean code.

I am deliberately setting up keys for all the selected checkboxes in that format ("123-456")because i want to extract the userid later for some other processing. I didn't find any other way to to it. Please advise.


Mallika gowd
Greenhorn

Joined: Sep 28, 2009
Posts: 26
Hi,

I am not able to understand by looking at the below code.

I will look in to it if you can please post entire code otherwise it is difficult for me to understand piece of codes which are syntactically not correct...
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

Why dont you guys use Code tags ??

Please do so, its makes your post easier to read, It is possible to edit post and add code tags too.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting up hashmap key in t:SelectBooleanCheckbox in a dataTable