This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to use El in custom tags

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to see the evaluated El in the output even though the body-content in tld is declared as scriptless.

WHy is After body appears after the EL expressions in the browser output ?

After body is in doEndTag() and i suppose doEndtag must run after the tag body evaluation .


ClassicTagTest1


TLD


JSP



Browser OutPut:
MOvies NOW
dostarttag
After body
${movie}
${movie}
${movie}
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does you web.xml start like this?



Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have the following in Web.xml
 
Stoian Azarov
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After tag appears before body evaluation because you are creating a table in HTML and After tag label is between <tr></tr> elements. Check the source code of your page:

You are supposed to put any text inside <td></td> elements, otherwise the text might appear in very strange place.
From the code of you example it is visible that doEndTag() runs after the body.

I tried your example and it works for me - the body is evaluated - of course I am using GlassFish 3.1.1

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using tomcat 5.5 and eclipse helios
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using tomcat 5.5 and eclipse helios

hmm, it was working on my tomcat server (v 5.5)

Try removing this line from your jsp:
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried removing the line from jsp and the code worked,but why was it affecting the output ?

please help
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2778
174
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what caused it to work as those lines are perfectly ok.

I think that your output was being cached by your browser (and that output was cached when you still had a mistake in your code). Sometimes hitting CNTRL-F5 will do the trick to make sure that you are looking at right output. It seems that changing the first line of your jsp made your browser to resubmit instead of getting your page from the cache.

Regards,
Frits
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!