Salim Khatib

Greenhorn
+ Follow
since Jan 06, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Salim Khatib

Hi everybody,

I want to share with you that today I passed SCWCD
I thank to everybody on this forum who have helped me to get the
concepts clear and give exam more confidently.

Would like to tell you guys, that this was my second attempt
I took my first exam on scwcd 1.5 on 29th December 2008 but I failed and
scored 65%, because my preparation was lacking in two things

1. I was not knowing about this forum.
2. I did not give any mock exams.

Keeping all this in mind I started my preparation again.

My statergy was reading
Head First, and spending daily 2 -3 hours on this forum.

--------------------------------------------------------------------------------
SCJP 1.4 : 75%
SCWCD 5: 97%

15 years ago
thanks for the quick reply

The below code will set the product attribute in the application scope right ?

<%

pageContext.setAttribute("product", new com.example.Product(" Pizza", 0.99));

%>

For the first answer I feel they should have mentioned scope as application
and for the second answer the scope is mentioned as page , which I feel should be application

please let know your suggestion


Given the jsp code

<%

pageContext.setAttribute("product", new com.example.Product(" Pizza", 0.99));

%>

<%-- insert code here--%> --- > what should be inserted here to output thename of the product in the response ?

Given answers are

1. <jsp:useBean id = "product" class = "com.example.product"/>
<%= product.getName()%>

2. <jsp:useBean id = "product" type = "com.example.Product" scope = "page"/>
<%= product.getName()%>

I think both the given answers are wrong

please let me know your suggestion guys , its urgent




Hi Punit,

I am not sure, but I feel the answer for Q3 is not MVC but should be Business delegate.

Can you please tell me what options are given for this questions ?
If you programatically set session.setMaxInactiveInterval(0)
it is equivalent to calling session.inValidate() where the session get invalid immediately
Given that

A servlet context listener load a list of com.example.Product objects from a database and stores that list into the catalog attribute of the ServletContext object.

Construct a jsp:useBean standard action to access this catalog.

The given answer is answer <jsp:useBean name = ‘catalog’ id = ‘catalog’ type = ‘com.example.Product’>

But I feel its wrong .. as there is no name attribute for jsp:useBean

Please correct if I am worng
Thanks for your reply

is that not true that useBean standard action first searches the "product" in all the scopes, and if it does not find it
then will create the the instance of product if the scope is not specified ?
The below is a Product bean class

package com.certkiller

public class Product {

private String name;
private double price;

public Product(){
this(“Default”,0.0)
}
//Setter and Getter methods
}

A session-scoped attribute, product, is stored by a servlet. That servlet then forwards to a JSP page. This attribute holds an instance of com.Certkiller.Product class with a name property of “The Matrix” and price property of 39.95.
Given the JSP page code snippet:

<jsp: useBean id = ‘product’ class = ‘com.Certikiller.Product’>
<jsp: setProperty name = ‘product’ property = ‘price’ value = ’49.95’/>
</jsp: Bean>

<%=product.getName()%>
Costs <%= product.getPrice() %>

What is the response output of this JSP page code snippet?

Ans. Given answer is : Default costs 49.95

But I think the answer should be: The Matrix costs 49.95

can anyone correct me
Can you try reversing the order or sequence of the exception

I mean More GeneralException(ie Throwable) to Specific Exception (ie Arithematic)

<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/exceptionPage.jsp</location>
</error-page>

<error-page>
<exception-type>java.lang.ArithmeticException</exception-type>
<location>/airthmeticPage.jsp</location>
</error-page>


Please let me know the result
Inside WEB-INF and META-INF directories