Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why this EL code part is not working

 
Sreeraj G Harilal
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?
 
Sayak Banerjee
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]}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic