• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

EL from HFSJ

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was going through chapter 8 of HFSJ and came through this EL
on page 394.

${requestScope[integer] ne 4 and 6 le num || false}

This whole expression return false but I am not able to find out how.

Could someone explain!
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kapil Munjal,

"${requestScope[integer] ne 4 and 6 le num || false}"

can be splitted into three subsets,

1. requestScope[integer] ne 4 AND
2. 6 le num OR
3. false

so, if either 1 or 2 evaluates to false , then the expression becomes

1) either as false AND true OR false --> false OR false --> FALSE
2) or as true AND false OR false --> false OR false --> FALSE

Hope this helps

Thanks and Regards,
Rufus
 
kapil munjal
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Johny,

Could you tell what "requestScope[integer]" will return.
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I thnk it will return null. what is about num in the EL?

Thanks
 
kapil munjal
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please go to page 394 of HFSJ and you will find the question.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kapil munjal:
Please go to page 394 of HFSJ and you will find the question.


requestScope[integer] return 0 but
requestScope["integer"] or requestScope['integer'] return 3
cheers
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sergio:

Can you please explain why would
requestScope[integer] return 0 but
requestScope["integer"] or requestScope['integer'] return 3

Thanks
 
kapil munjal
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can you please explain why would
requestScope[integer] return 0 but
requestScope["integer"] or requestScope['integer'] return 3



requestScope[integer] return 0

- It will look for a attribute with the name 'integer', and it will find the value of this attribute as 3. But till now this expression has not looked into requestScope. Its just the EL which is being processed. Now, it will look for the 4th element in the requestscope and it will not find anything as there are only 3 elements (0,1,2). So, it will return 0.


But it we do this -
requestScope["integer"] or requestScope['integer'] return 3

It will look for a map value with the key 'integer' and it will find the second key in the map and return the value 3.
 
sergio mendez-rueda
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kapil munjal:


requestScope[integer] return 0

- It will look for a attribute with the name 'integer', and it will find the value of this attribute as 3. But till now this expression has not looked into requestScope. Its just the EL which is being processed. Now, it will look for the 4th element in the requestscope and it will not find anything as there are only 3 elements (0,1,2). So, it will return 0.


But it we do this -
requestScope["integer"] or requestScope['integer'] return 3

It will look for a map value with the key 'integer' and it will find the second key in the map and return the value 3.


Hi Kapil,
your explanation is fine!!

thanks,
sergio
-----
Toto, I don't think we're in Kansas anymore
--Dorothy, from the Wizard of Oz
 
Forget Steve. Look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic