Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tag question.

 
chani singh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
It'll give an exception saying value is not initialized!

d <generator:random><%getParameter("value")%></generator:random>


e None of the above.

hey guys, can uhelp me out wd this Qn..
the ans is b..why???/
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no default body-content for simple/classic tags.
But if JSP were to be specified as body-content then the expression
<%=value%> would work.

You need to read up on "Variable Synchronization" topic from JSP specs to understand how the output of the custom tag works.

Regards,
Shivani
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic