Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question on el and standard action

 
mani kanth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1)Which EL expression evaluates to the request URI?

1) ${requestURI}
2) ${request.URI}
3) ${request.getURI}
4) ${request.requestURI}
5) ${requestScope.requestURI}
6) ${pageContext.request.requestURI}
7) ${requestScope.request.request.URI}

the given answer is:
1

but i think its 6.

how it is 1.

Q2)A JSP page needs to instantiate a JavaBean to be used by only that page.
Which two jsp:useBean attributes must be used to access this attribute in the JSP
page? (Choose two.)
A. id
B. type
C. name
D. class
E. scope
F. create

the given answer is:
A,B

i think its A,D

A JSP page needs to instantiate a JavaBean to be used by only that page.???

what is meant here used by onlythat page?
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think your answers are correct.
A JSP page needs to instantiate a JavaBean to be used by only that page.???

means its scope is only inside that particular jsp page.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I agrree with you about first question. The correct option is 6.

Q2)A JSP page needs to instantiate a JavaBean to be used by only that page.
Which two jsp:useBean attributes must be used to access this attribute in the JSP
page? (Choose two.)
A. id
B. type
C. name
D. class
E. scope
F. create


I am not getting the meaning of the second question. The useBean action is used to instantiate the scoped variables ( attributes) in particular scope. It also introduce scripting variables in the JSP page. But to access these variables you have to use getProperty, or EL expression or some scriptlets.

I does not understand how the useBean can access the attribute.

Thanks
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Besides the wording confusion I also go for A,D. As the bean is created in the page scope, the id is essential and as a page scope you have to instantiate the bean in the same page, so the class or beanName attribute is required.

Thanks
 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For a new Bean to be instantiated beanName or class is required. If you use just type, then an instance of that bean must already exist. if one does not already exist, no instance is created.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic