• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic