| Author |
How to show composite string for listValue attribute in select tag in Struts2 without using iterator
|
Saikat Podder
Greenhorn
Joined: Jan 09, 2009
Posts: 5
|
|
Hello Friends,
I am new to Struts 2 & I need your little help to clear a confusion,
I want to display a Dropdown menu for Plans/Packages from a list of Plan object(List<Plan>). The plan class has fields like id, name, price etc.
so the code for the dropdown menu would be:
But this only shows only the name of the plan(like "basic", "intermediate" etc.) in the menu, & I want to show some additional info besides the name like "basic : 5$/month", "intermediate : 10$/month" etc.) for that I need to use the price field of the Plan class also in the listValue expression.
I have tried several expressions like listValue="name : price $/month" or listValue="%{name} %{price} $/month" but none of the works.
So for now the only thing working for me is the normal html tag within an iterator.
So is it really not possibly to display composite string as the value of listValue attribute of the select tag? or am I missing something?
Thanks in advance
Saikat
|
 |
Sonny Gill
Ranch Hand
Joined: Feb 02, 2002
Posts: 1211
|
|
Use
|
The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
|
 |
Saikat Podder
Greenhorn
Joined: Jan 09, 2009
Posts: 5
|
|
Thank you Sonny,
It worked wonderfully
But apparently the same expression does not work for all types of attributes.
|
 |
bilbono notry
Greenhorn
Joined: Oct 28, 2009
Posts: 3
|
|
Hello,
I have a more complex problem on the same topic.
I would like to do the
stuff, but 'name' would be dynamically generated to include country code.
Someone know how I can do that ?
I tried
but it does not work, just print nameEN several times in the select
Thanks
|
 |
bilbono notry
Greenhorn
Joined: Oct 28, 2009
Posts: 3
|
|
|
Nobody ?
|
 |
 |
|
|
subject: How to show composite string for listValue attribute in select tag in Struts2 without using iterator
|
|
|