This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Why this EL code part is not working  RSS feed

 
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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]}
 
I've never won anything before. Not even a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!