M Jairam

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

Recent posts by M Jairam

Regarding question # 4:
My book has the answer marked as only A.
However, I think the answer should have been A and B.
Why is "b2.getFoo() == null" not correct?
Please let me know.

FYI: My book is published in US in 03/2005.
I just got back from the book store. They have two copies of HF-EJB both first edition printed October 2003, they both have the same number of pages.
However, one book is thinner (about 2/3) and lighter than the other.

My question is, does any body know for sure, which is the latest print. The reason being, they generaly address errors in latest print. The book store said they don't have any info. on which is the latest print. But, they did say the thicker book was stocked two week later than the thinner book (both in September of this year).

Any input is appreiciated.
Javaranch "Mock exam" is not working for atleast the last three days - when you click on the "Proceed with the Mock Exam", it displays an error page. Can anybody please fix this.

Your original question as to <servlet-name> is treated as <url-pattern> if under <filter-mapping>, the answer is "you are correct". Also, note that <servlet-mapping> is independent of <filter-mapping>. <servlet-name> appearing under <filter-mapping> is like an exact match.
However, note one difference between <url-pattern> and <servlet-name> under <filter-mapping>, the ordering of filters - which is very important - are different between the two. The container will first take all filters matching the url, first against all of the <url-pattern>, in the order it appears in the DD, and then will match against all of the <servlet-name>, in the order it appears in the DD.
[ December 14, 2005: Message edited by: M Jairam ]

Actually, the following are the only two elements that are mandatory in taglib. Note that "uri" is not mandatory:


You can either refer to the spec. or use the following link:


[ December 11, 2005: Message edited by: M Jairam ]

The problem with your code is mainly with the attribute items in the <c:forEach>. You are using the EL expression ${myList}. This means that an attribute should exist in one of the scopes (page, request, session or application).

In your code you only declared a local variable String[] called "myList". Thus, you must set the attribute in any one of the scopes.
pageContext.setAttribute("myList", myList)
request.setAttribute("myList", myList)
session.setAttribute("myList", myList)
application.setAttribute("myList", myList)
or any one of the following:
pageContext.setAttribute("myList", myList, pageContext.REQUEST_SCOPE);
pageContext.setAttribute("myList", myList, pageContext.SESSION_SCOPE);
pageContext.setAttribute("myList", myList, pageContext.APPLICATION_SCOPE);

I think Charith Fernando is correct.

Please note that my conclusions are based on my own observations after reading the error page from O'reilly for HFSJ, contents in this thread and specifically HFSJ page 262.

The question of if a listener has to be entered in DD depends on the type of class implementing the listener.

First let us look at each of the listeners and see who can implement them (HSFJ Page 262):

HttpSessionListener ........Implemented by some class (other than attribute class).

HttpSessionAttributeListener...Implemented by some class (other than attribute class).

These two have to be entered in the DD - otherwise the container will not know of it existance.

HttpSessionBindingListener...Implemented by an Attribute class.

This does not have to be entered in DD - because any attribute added to a session, can be checked to see if it implements this listener interface and thus can be notified.

Now comes the interesting part:

HttpSessionActivationListener....Implemented by an Attribute class AND by some other class.

Now, my believe is that you will have to enter this listener in DD if it is implemented by "some other class" and does not have to be entered in DD if it is implemented only by Attribute classes.

Let us know if Charith and my observation is wrong.

On Page 273, the following is the question:

Which statements about HttpSession objects are true?
C. A session will become invalid after a timeout period defined by the servlet container.

The book says "C" is correct. I think it is wrong. The session only becomes invalid after a timeout period defined by the container only if its "inactive time" exceeds the timeout period.

Is my observation correct or am I misreading. Please let me know.

Surya Venkata:


Thanks for taking the time to give valuable information for preparing for the exam. I really appreciate it.

17 years ago
The following is my observation:

1. If you don't specify the scope attribute in <jsp:useBean..>, then the scope defaults to "page". (Ref: HFSJ top of page 355).
So, in the situation where you don't have a scope attribute with
<jsp:useBean id="person" type="foo.person"/>
the scope defaults to page, and the statement is same as having:
<jsp:useBean id="person" type="foo.person" scope="page"/>
In summary, it will not search or find in any other scope (unlike an EL attribute where it will search in all four scopes).

You can try this with the following example:

<%@ page import="foo.*" %>

person lclperson = new foo.person();
pageContext.getSession().setAttribute("person", lclperson);

// pageContext.setAttribute("person", lclperson);


<jsp:useBean id="person" type="foo.person" />
<jsp:setProperty name="person" property="name" value="SomeName" />
<jsp:getProperty name="person" property="name"/>


The java bean:

package foo;

public class person {

private String name = null;

public person() {
name = "";

public String getName() {
return name;

public void setName(String inname) {
name = inname;


2. For the second question, your observation is the same as mine, that is it does print "Second Page" - this only if I ignore the following syntax error in your post:
<jsp:getProperty name="bean" property="name">
is not properly terminated, if above line is used as is, you will get compile error.

Hope this helps.


What is the meaning of your reply above? I did not get it. "It will not search in all scope." is correct. However, the next sentance you mention "class/beanName" - what has this got to do with scope - I don't think scope depends on these attributes in anyway. Also, what did you mean by "given scope"? May be you ment the default scope - "page"...

The notes is in:

"U can find it in scwcd_meda(yahoo groups)---Just go to the files section ."

You can find more details in the following discussion:


Also, note that this notes is for the older exam (I believe it was created in 2001).

Any reference to an image file on a generated page is handled the same way - the browser will make a request for the second time to the image source (on the server) to retrieve the image - this happens irrespective of if the page was generated by a single jsp servlet (such as in include directive) or if the page was generated by a jsp servlet which included one or several other jsp servlet response via jsp include standard action.

In summary, if you change the image file on the server, in either case you will see the most recent image file (unless caching is turned on, then in both the cases you might see the older cached image).

However, note that I am aware of the fact that, say you have J1.jsp which includes J2.jsp, then with the directive, if you change J2.jsp, it will continue to use the content of older J2.jsp (which is now part of J1.jsp) until you change J1.jsp or delete the geneated J1's servlet class file.

Having said that, I don't think the question was realted to generating dynamic content by changing the file J2.jsp. When generaly "dynamic content" (such as jsp file) as against "static content" (html file), is being referred, "dynamic content" is generated not by changing the underlaying file on the server, but by variables such as the specific user who is making the request or other variable factors such as time of request etc.

In summary, my comment is that you can generate "dynamic content" in both cases - option A and B.
Please note that I fully understand how include directive works and how include standard action works - that is, one includes the content of the file into the main servlet at translation time and the other creates a separate servlet and every time the request comes makes a call to this separate servlet to get the contents included in the final response. This only explains what happens on the server.

But the questions is not asking what happens on the server. It is asking for dynamic content - meaning, same request made at different times should produce possibly different result or view - as viewed on the browser (not how it is done on the server).

Now, given option A or B, how can we say one can produce dynamic content and not the other?
Jayne Congratulations!

You said that the questions on standard actions were complex. Then what is the best way to prepare for this? Any suggestions are highly appreciated.

17 years ago
Jayne Congratulations!

You said that the questions on standard actions were complex. Then what is the best way to prepare for this? Any suggestions are highly appreciated.