• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Why this EL code part is not working

 
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have added a function named getAllBrands()to the BeerExpert class of HFSJ Book to check the EL [].But its not working why?

scriplets is working without any problem for tha ArrayList.

The codes are below
form.html


BeerExpert.java


SelectBeer.java


result.jsp



Can anyone can find out the problem?
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i put
<br>${styles[0]}
<br>${styles[1]} int result.jsp

its works without any problem.

Can anyone can find out the problem?
 
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry but I fail to understand one thing....why do ya have <String> associated with List and ArrayList in the BeerExpert class?
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is Generic version of Collections.That's in Java 5.
I am using java5 compiler. If am not using Generic Collections my i have to specify $javac -Xlint:unchecked <filename> for compilation.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If ya consider an EL like ${firstThing.secondThing} or
${firstThing["secondThing"]} firstThing has to be an attribute or an EL implicit object....when you're using ${styles[0]} its workin' fine because "styles" is a request attribute....but ${brands[0]} won't work because "brands" is neither an EL implicit object nor an attribute in any of the 4 scopes....
Hope that answers your question
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Sayak, i got the answer.
I change the code so its working now


<br>${be.allBrands[0]}
<br>${be.allBrands[1]}
<br>${be.allBrands[2]}
<br>${be.allBrands[3]}
 
Yeast devil! Back to the oven that baked you! And take this tiny ad too:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic