• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in custom tags

 
swapna rao
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide me the right answer.
In one of the mock exams of JavaBeat i have the following question.

1.you are using a tag library with prefix "generator", which supports a tag named "random". This tag generates a random number and sets it to a variable named "value". Which of the following will output this value in the page?
Select 1 correct option.
A.<generator:random>value</generator:random>
B.<generator:random><%=value%></generator:random>
C.<generator:random><% int value;%> <%=value%></generator:random>
D.<generator:random><%getParameter("value")%></generator:random>
E.None of the above

The mock exam states the answer as B. As per my understanding , scriplets,expressions,declarions are not allowed wothin custom tags.It is mentioned in HFSJ.Am i right?Please clarify it.
 
swapna rao
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only for Simple tags scriplets are not allowed within body content. I got confused and now i have understood.The given answer is right if we use classic tag handler model.please correct me if i'm wrong.
 
Bryan Basham
author
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by d swapna:
Only for Simple tags scriplets are not allowed within body content. I got confused and now i have understood.The given answer is right if we use classic tag handler model.please correct me if i'm wrong.

You are correct. For Option B to be correct the tag handler must be a Classic tag and could not be a Simple tag.

-Bryan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic