• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

tagdependent in tag files

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%-- WEB-INF/tags/body.tag --%>
<%@ tag body-content="tagdependent" %>
Start <jsp:doBody /> End

<%-- output.jsp --%>
<%@ taglib prefix="ayo" tagdir="/WEB-INF/tags" %>
<% request.setAttribute("position","Middle"); %>
<html><body><ayo:body><%= request.getAttribute("position") %></ayo:body></body></html>

Answer:"Start End"
Reason: body-content is tagdependent, so it allows scriptlets, which is not evaluated.So no exception thrown.
------------------------------------
My question is: tagdependet treats body content as simple text. In this case, shouldn't the answer be "Start <%= request.getAttribute("position") %> End"?
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On this post, you can see that you can have scriptlet inside the body of a tag file but they are ignored when you call "<jsp:doBody/>".

https://coderanch.com/t/507530/java-Web-Component-SCWCD/certification/called-tag-file-scripting

Correct me if I'm wrong.
 
Joe Allen
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So in this case, scriplets are neither evaluated, nor output as simple html text. Thanks for the answer.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic