• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tagdependent in tag files

 
Joe Allen
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • 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"?
 
Fabian Angy
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • 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/>".

http://www.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
  • Quote
  • Report post to moderator
So in this case, scriplets are neither evaluated, nor output as simple html text. Thanks for the answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic