This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can EL expressions access variables in the script?  RSS feed

 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a question on EL expressions. Do they only have access to scoped variables( I mean variables in the page|session|request|application)?
Can they, in any way, make access to those variables defined in scriptlet or jsp declarations?
thanks
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Zheng:

Can they, in any way, make access to those variables defined in scriptlet or jsp declarations?
thanks

Yes, they can access all of the variables defined in the scriptlet or jsp declarations... Simply use the bean name to access them directly... Really EL make JSP easy to be developed...
 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Ko Ko
So the variables being accessed must have appropriate getter methods, simple variables like Strings or Integers are not eligible for accessing. Am I right?
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Zheng:
Thanks, Ko Ko
So the variables being accessed must have appropriate getter methods, simple variables like Strings or Integers are not eligible for accessing. Am I right?

Yes, u r right, Henry... The Beans must have the proper getter mothods to do things with ELs.... It means that the Beans to be used must be created the specification mandated by the standard JavaBeans Specifications...
BTW, your surname is Zheng, which is the same with me... I'm half chinese and my surname is Zheng too...
 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, I'm chinese.
Per my knowledge, you are in india, right?So we are kinda close
BTW when are u gonna take the beta?
I'm gonna take it on the 29th...not so confident yet,especially on the el part...
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Zheng:
Yup, I'm chinese.
Per my knowledge, you are in india, right?So we are kinda close
BTW when are u gonna take the beta?
I'm gonna take it on the 29th...not so confident yet,especially on the el part...

No no... I'm a Chinese-Karen, currently residing in Thailand...
I feel that EL is easier than custom tags(Tag Files, Classic Tags and Simple Custom Tags)...
I'm taking it on coming Monday, 26th Jan...
 
Henry Zheng
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//blush
anyway, wish you good luck on the exam
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!