• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with passing expression to a hashmap key in a dataTable column

 
vishnu bola
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

Can someone help me with passing an expression like "123-456" to a hashmap key in my dataTable where 123 is userID and 456 is accountID. In my dataTable i have t:columns tag which generates checkboxes for each row in the dynamic column .The value of checkbox must be identified by a combination of userID and accountID. So i want to set value of checkbox something like this'userID-account.ID' .

But it never returns the right value since userID is taken as string instead i want the value of userID to be passed in that expression. Someone please help...iam struck with this issue from so long.Here is the code.

page1.jsp


Backing bean:
In this selectedUserIds iam intentionally setting up key something like "userID-accountID" so that i can split the userID and accountID for later user





somebody please to my email. If you need further information iam very happy to provide any time. Also let me know if there is another way to get this job done..

Thanks very much in advance
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vishnu,
I'm having the exact same problem, and am stuck into it, probably if you can please assist me with the way
you solved your problem, or any way you managed achieving that.
Hope some one else, might have an answer also.
Thanks..
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try something more like:



Actually, I don't really recommend coding up that much complexity in EL because you end up spending a lot of time on puzzles like this and you risk putting what should be Model logic into the View and violating MVC. But when you quoted your variable names, you turned them into a string literal, as you saw. What you really want is a string concatenation with 2 variables joined to a literal.
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Tim for the reply, but that wouldn't work, it's throwing NumberFormatException '-' !!??
any idea why ?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Qussay Najjar wrote:thanks Tim for the reply, but that wouldn't work, it's throwing NumberFormatException '-' !!??
any idea why ?


Probably because I got my languages crossed and "+" doesn't work as an EL concatenation operator there. I'd have to RTFM to be able to say for sure.
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any new ideas, i'm still stuck with it
i have to use this logic, couldn't find a replacment
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, I'm in the middle of something complicated, so the only suggestions I can give are to either move the computations off the page and into a backing bean or to read up on the EL documentation. My recommendation is to try and get the computations off-page, as it's usually easier.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic