Xiaoxiao Lam

+ Follow
since Mar 04, 2006
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 Xiaoxiao Lam

Originally posted by Chetan Parekh:

I want to develop a small software. If you want to work on it, just send me an e-mail.

You will get no rewards, but the exprience.

Thank you, Chetan. I sent you an email.
16 years ago
I just finished SCJP and SCWCD exams. Now, I want to do more practice with Java. And I want to get some experience with some big projects. Any idea what I should do next? Do you know anywhere I can find some open sources projects, not necessary to join them now, but I want to read some real codes first.

Thank you.
16 years ago

Originally posted by Satou kurinosuke:

You should have tried harder


Thank you! I think there must be one Listener that I don't know about and it's one of the answers. I only know those mentioned in HFSJ. I will try to learn more.
I took the exam today. Before the exam, I believed that both of them don't need to be declared in DD. But in the exam, I met a question which made me confused. It asks for 3 Listener Interfaces/Classes that must be declared in DD, I tried to find 3 answers without considering both of these two kinds, but I couldn't. So, at last I selected HttpSessionActivationListener, too. I don't know if I answered that question right or not.

By the way, I passed the test with 85%. Not bad.

Originally posted by Satou kurinosuke:
I don't own the book. How is it written exactly ?

It's written:

Q: does the Tag File have access to the request and response implicit objects?

A: Yes! Remeber, even though it's a .tag file, it's gonna end up as part of a JSP. You can use the implicit request and response objects (if you do scripting..the normal EL implicit objects are always there as well), and you have access to a JspContext as well.

You don't have a ServletContext, though -- a Tag File uses a JspContext instead of a ServletContext.

--------It's exactly like this. Please let me know what you think. I will take the exam tomorrow... Thank you..
[ March 16, 2006: Message edited by: Xiaoxiao Lam ]
On HFSJ Page 500, Second paragraph, it says: You don't have a ServletContext, though--a Tag File uses a JspContext instead of a ServletContext.

But I know Tag File has following implicit objects:
out, request, response, session, application, config and jspContext

And application is of Type ServletContext. Tag File doesn't have pageContext, instead it has jspContext. Is it a typo on the book?

Please help me! Thank you.
I am confused now again when I read P447 on HFSJ where it says ${fooBean.notAProperty} won't cause an exception. Anyone can explain? Thank you.
On page 518 (Bullet Points) of Book HFSJ, it says:

"The getJspBody()method returns a JspFragment which has two methods: invoke(java.io.Writer) and getJspContext()that returns a JspContext the tag handler can use to get access to the PageContext API (to get access to implicit variables and scoped attributes)."

I don't think this sentence is right. PageContext class extends JspContext class. If getJspContext()returns a JspContext, we can't use it to get access to PageContext's Fields. Or I misunderstood anything. Please help me understand this. Thank you.
I didn't put any other content including "<html><body>" tags in the html file at all. Both include and forward method didn't work. And once I changed the file extension to be .jsp, both of the methods work.

I am wrong. API says

it includes the contect of a HTML file too. So make sure you have a .html file

Yes, I had html file there when I used html file path and it didn't work. When I changed the html file to be a jsp file and used jsp file path, it worked.

Error Message when I used html file:


org.apache.jasper.JasperException: getOutputStream() has already been called for this response
[ March 14, 2006: Message edited by: Xiaoxiao Lam ]
Thank you, Chandu. I supposed it would work if we put the code inside <% %>, but when I tried it using the exact code as choice D, it didn't work. I changed the file "footer.html" to "footer.jsp", it worked. Do you know why? Thank you.
Here is the question for Q22 of the final Mock Exam:

Given that /segment/footer.html is a static page, which JSP code would you use to include static content in a JSP?

A. <%@ include file="/segment/footer.html" %>
B. <jsp:forward page="/segment/footer.html" />
C. <jsp:include page="/segment/footer.html"/>
D. RequestDispatcher dispatcher=request.getRequestDispatcher("/segments/footer.html");

The answers given are A and C. I understand why A and C are right. But my question is why D is not right? I want to know the exact reason. Is it because they should be inside <% %>? Or because HTML files can not be the argument of getRequestDispatcher()? (I tried it and it didn't work, but I don't understand because the document says it can include html files, jsp files and Servlets.) Thank you.
I think if the question asks for 1 answer, only C is right and if it asks for 4 answers, all are right. :-)