This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes A couple questions: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "A couple questions:" Watch "A couple questions:" New topic

A couple questions:

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

From David Bridgewater mock on

1.The Default value for body-content element of tag library descriptor is:JSP
Is this right?Because I know that HFSJ mentioned scriptless being the default...

Cant remember where this question is from:
2.No xml elements should appear before <web-app> in a JSP document
What about the <?xml....> and <jsp:root> elements??

3.Could someone explain the basics(that I should remember) of forward referencing to me?

4.From HFSJ pg 356:

Assuming no bean is found,will this just make a scripting variable of type foo.Person available??

5.From David Bridgewater mock on
All objects placed in a session must invariably implement
Sessions for a web application can be distributed across several JVMs, but any one session must remain attached to a single JVM.
My observation:Aren't sessions migrated across VM's??
Also : Doesn't HFSJ state that session attributes don't need to be Serializable,but if they are,then the container is required to migrate them(although it is a good idea to have all your session attributes be serializable)

6.From David Bridgewater mock on

Filter mappings must be defined within the web.xml deployment descriptor, before listener definitions which in turn come before servlet definitions.

Observation:I didn't come across anything like this in HFSJ,is it maybe behaviour from earlier versions of the DD or something?

7.From David Bridgewater mock on
A browser sends a request containing no headers to a servlet. What is the result of executing the following method within the servlet?

Never mind the is it possible to senda request with no headers??

Also,I do know about the whole "One thread one question" thing,but do you really want seven different threads??

===>SCJP 1.5(72%)<===
Shruthi Sam
Ranch Hand

Joined: Jul 09, 2008
Posts: 73
Hi Duran,
The answer for your first question is ....

As Per JSP 2.0 Scriptless is valid. The three possible values as per JSP 2.0 is tagdependent/empty/scriptless.

As per the earlier version, tagdependent/JSP/empty are valid.

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Okay so currently 'scriptless' is the default but for the older versions of JSP ,'JSP' is the default
Shruthi Sam
Ranch Hand

Joined: Jul 09, 2008
Posts: 73

for your second question,

Again <jsp:root> is not required as per JSP 2.0 .

XML declaration is also not needed as <?xml version="1.0" encoding="UTF-8" ?> is the default XML declaration.

you can go through the below link for more information about JSP Documents.

Hope it helps.

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

So then if I had a file:"something.jspx"
and it only contained the following:

It would be a legal JSP document?
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Anybody willing to take a shot at the last 5 questions??
Abdul Rahman
Ranch Hand

Joined: Jul 04, 2008
Posts: 63
Hi Duran,

Here are the answers to three of your last 5 questions.

Forward referencing means you refer to a variable before you have actually declared it in your code. Keep it in mind, that forward referencing is not allowed in methods. a small example.

for more details you can check this link forward referencing.

for question 4
if you are using <jsp:useBean> with a type and without any class, then you must ensure these 2 things:
1 - the bean should already exist in the scope defined. (page is the default)
2 - if the person attribute doesnot exist in the page scope, it will throw a java.lang.InstantiationException.

answer to question 5
sessions are migrated across VMs. to successfully migrate your session attributes across VMs you need to make sure either of the two things:
1 - make sure your attribute class types are Serializable.
2- if they are not Serializable for some reason, have your attribute object class implement HttpSessionActivationListener and use the activation/passivation callbacks to work around it.
HFSJ states in clear terms that:
A container is required to migrate Serializable attributes. But a container is not required to use Serialization as the means for migrating the HttpSession objects.
This means the above 2 points i mentioned.

SCJP5, SCWCD5, [scwcd wall of fame]
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Thank you.
It is sorta covered in the JavaRanch Style Guide.
subject: A couple questions:
Similar Threads
Some more stuff for WCD Guys
Cleared SCWCD - 97%
Mock Exam Queries from JDiscuss..
Security Contraints setup..
My Study Notes !!!