Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL question

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw a question is given:

http://domain/scwcd/tmp.jsp?name=blah

it uses ${param.name} to get value of name which is blah,
but how to write EL to get variable name 'name' itself?

thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"param" is a Map. You could use forEach to browse through all parameters
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Check code above now consider that url is
http://localhost:8080/mapping/result.jsp?name=gowher&address=mumbai
output will be-:
1address=mumbai
2name=gowher
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks gowher for the example.

I just noticed that the pair printed is the reverse order of appearing in the URL, address first, and name second.

Is it the way that always does?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to add that you can separate key and value that way (because variable called p is a Map.Entry):
 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked this with tomcat 5.5 and tomcat 6.0 5.5 prints attributename=value whereas when I ran the same in 6.0 its giving me only the object id.has anyone noticed this?
 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone please explain me the change in behaviour
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic