wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes tagdependent in tag files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "tagdependent in tag files" Watch "tagdependent in tag files" New topic
Author

tagdependent in tag files

Joe Allen
Ranch Hand

Joined: Nov 14, 2012
Posts: 93
<%-- 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"?


"There are no dumb questions" quoted from HFSJ. "To err is human; to forgive is divine"
OCPJP 6, OCEJWCD 6
Fabian Angy
Ranch Hand

Joined: Oct 27, 2008
Posts: 90
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.


SCJP 5
Joe Allen
Ranch Hand

Joined: Nov 14, 2012
Posts: 93
So in this case, scriplets are neither evaluated, nor output as simple html text. Thanks for the answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tagdependent in tag files
 
Similar Threads
Page 501-Memorizing Tag Files
tag body content question
Doubt on tagfile body content
Need clarification on Ch. 10 mock question 17.
allowable body-content values