Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Expression Language  RSS feed

 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In EL, if the thing on left side of [] is either an arrayList or Array, then the thing inside [] could be with or without double quotes, that doesn't make any difference. But if the thing on left side of [] is an implicit object or bean then the thing inside [] matters when used with or without qoutes.


For example
Consider following two code snippets

String s[] = {"abc", "def"};
request.setAttribute("string", s);



We can access the string array element in both ways


But
$ are different and use of quote make sense.

Please let me know whether my above understanding is correct or wrong.


 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In first case, name gets evaluate first and then used in bracket[], In second case "name" will be used at it is and written as ${person.name}.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get the proper picture of How EL variables get evaluated, See:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html#wp84857
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!