• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Edurardo Cobian's mock exam

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could someone please explain to me the answers to the followng questions from Edurardo Cobian's mock exam?
Question 3)
Which of the following staments are correct about the following jsp lines:
<jps:useBean id=�name� class=�java.lang.String� />
<%= name %>
1) It won't compile.
2) It is a valid jsp line and it will print the variable called name.
3) It will compile but it will always produce null as the output.
4) It will work if you create a javabean class with only one variable of type
java.lang.String.
Answer 3)
2) It is a valid jsp line and it will print the variable called name.It will work.To have valid functionality you have to set an attribute of String type in the proper scope before it is accessed by <jsp:useBean ...>
===============================================
Question 13)
Inside the body ( <elemnent>body</element> of which elements can you use the element
jsp aram?
1) <jsp:include ...>
2) <jsp:forward ...>
3) <jsp arams >
4) <servlet-params...>
Answer 13)
1)<jsp:include ...>
2) <jsp:forward ...>
3) <jsp arams >
I don't think Answer 3 is correct because there is no <jsp arams> tag.

Thanks,
Andy
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am agree with you for question 13.
The answers are 1 and 2. There is no tag
For question 3, i think there is no answer.
Because
<jsp:useBean id="name" class="java.lang.String"/>
is same with : java.lang.String name = new java.lang.String();
And <%= name %>, it will print the object name.
Correct me if i am wrong
daniel
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
about question 3:
Yes,
it equals to
<%
java.lang.String name = new java.lang.String();
out.println(name);
%>
The name is initilized as an empty String.
So it compile OK and print nothing.

about question 13:
<jsp arams> is child tag of <jsp lugin ...>
So the answer 3 is correct.
 
Do not set lab on fire. Or this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic