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

<jsp:useBean> in scriptless page

 
Kanishka Ajwani
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we use <jsp:useBean> in a scriptless page?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. A tag is not a scriptlet.
 
Kanishka Ajwani
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what I thought. But this question from Whizlabs practice exam 3 confused me. The question is:

What happens when <jsp:useBean> is used in scriptless pages?

A) A Java scripting variable is created.
B) An EL is created
C) A translation error occurs
D) A runtime error occurs


The correct answer is B. The explanation given says that since the page is scriptless, <jsp:useBean> will be converted into EL.

If it is converted to EL for scriptless pages, what happens when <jsp:useBean> is used in pages that accept scripting?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question does not make much sense, and you won't see that kind of question at the exam.
I think that they want to ask what will happen to the tag after the JSP's been translated into a servlet.
I don't think that the way it is translated will change depending on whether or not scipting is enabled.
But feel free to check it using a web container like Tomcat
 
Kanishka Ajwani
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic