This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

how to set value in a map?  RSS feed

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started to learn JSPs and stuck on how to set values in a map.
Suppose i have the following:
<%Map map = new HashMap();
map.put("Mon", "Monday");
map.put("Tue", "Tuesday");
map.put("Wed", "Tuesday");
map.put("Thu", "Thursday");
map.put("Fri", "Friday");
map.put("Sat", "Saturday");
map.put("Sun", "Sunday");
%>//I can get value like this:
<%= ((Map)pageContext.findAttribute("map")).get("Wed") %>
//or like this <c ut value=" ${map.Wed}"/>
//this does not work:
<%-- <c:set value="Wednesday" target="map" property="${map.Wed}" /> --%>

I looked everywhere but it supposed to be so self-evident that details are found nowhere.
Please help me how to do it, because I'm stuck here. I'm dumb.
:-)
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use:
<%map.put("Wed","WEDNESDAY");%>
It will replace previous value.
 
Svetlana Koshkina
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No no no, thanks.
I know how to program. Scriplets don't count. I want jstl way. :-)
???

Originally posted by Sergiy Kamenyev:
You can use:
<%map.put("Wed","WEDNESDAY");%>
It will replace previous value.

 
Author and ninkuma
Marshal
Posts: 66807
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch skaa!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Fourm Bartender
 
Svetlana Koshkina
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's my name: Svetlana
Koshkina is valid family name in Russian though assumed (if you want to see my true family name that is sort of complicated you can visit my web site).

Originally posted by Bear Bibeault:
Welcome to the Ranch skaa!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Fourm Bartender


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66807
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Svetlana, I like your name just fine. It's skaa's that that post was directed at.
bear
[ October 03, 2003: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!