*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Why this EL code part is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Why this EL code part is not working" Watch "Why this EL code part is not working" New topic
Author

Why this EL code part is not working

Sreeraj G Harilal
Ranch Hand

Joined: Apr 19, 2006
Posts: 310
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?


SCJP 5.0<br />SCWCD 1.4<br />Preparing for <b>SCEA</b>.<br /><b>"I prefer an interesting vice to a virtue that bores."</b>
Sreeraj G Harilal
Ranch Hand

Joined: Apr 19, 2006
Posts: 310
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

Joined: Nov 28, 2006
Posts: 292
I'm sorry but I fail to understand one thing....why do ya have <String> associated with List and ArrayList in the BeerExpert class?


Turn on, tune in, drop out.
Sreeraj G Harilal
Ranch Hand

Joined: Apr 19, 2006
Posts: 310
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

Joined: Nov 28, 2006
Posts: 292
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

Joined: Apr 19, 2006
Posts: 310
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Why this EL code part is not working