Anupama Ponnapalli

Ranch Hand
+ Follow
since Jun 12, 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 Anupama Ponnapalli

also, the session local variable in _jspService method will be of type HttpSession - corresponding to the jsp implicit object.

The filter-mapping web.xml entry takes another child element, called Dispatcher. It can have 4 possible values: REQUEST, INCLUDE, FORWARD and ERROR. This determines the type of requests handled by the filter.

If this child element is missing, the default value is REQUEST. So, if your filter used Source as the servlet, it would work.

For destination, try this:

<filter-name> ... </filter-name>
<url-pattern> ... </url-pattern>

By the way, you can have upto 4 dispatcher elements, so you could very well write a mapping that ensures that all requests types are handled by the filter!

[ April 13, 2007: Message edited by: Anupama Ponnapalli ]

The real exam always indicates the number of correct number of options to select for a question. The mock exams in most book do not - they just try to make it a little more difficult.

This is the SCWCD forum, you might want to direct questions about SCJP to its dedicated forum.

[ April 10, 2007: Message edited by: Anupama Ponnapalli ]
Satou is right.

Filter Chaining Rules:

1. All filters with matching URL patterns are located. They are executed in the order of declaration in the DD.
2. After this, all the filters with the matching servlet-name in the DD are located and executed in the order of declaration.
The print methods seem to be wrappers around the write methods.


public void print(String s)

Print a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.

s - The String to be printed


public void write(String s)

Write a string. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.

write in class Writer

s - String to be written

The print - println methods are the most commonly used ones with servlets. Most IO classses have write methods, maybe it comes from there.
Looking at the jsp source generated for the EL expression might help too
There's a javaranch write up on this:

Check it out - does it answer your question?
Request attributes are used to share information between different J2EE components that play a role in processing a single request. For example, if a servlet controller validates a request and forwards it to a JSP, the servlet could place validation errors in the request. These are no longer relevant after the response is rendered, and are discarded. On future requests, if you try to retrieve them, you will get a null value.

Request attributes come into existence when added to request object and go out of scope as soon as request processing has completed (unless you remove them first). By completion of request processing, I mean the last component that handles the response, such as a JSP or a filter or a servlet. You can run tests on scope by implementing listeners such as ServletRequestListener and ServletRequestAttributeListener.

On the other hand, if you need to display user name on all pages that a user visits after the user has logged in, you'd store a user object in the session. Thus the object would be available to all components of across requests that come in while the session is still active. You could test this by implementing HttpSessionListener or HttpSessionAttributeListener.

Does this answer your question?
The purpose of the skip page exception is achieved in classic tags by returning SKIP_PAGE from the doEndTag.

Does that answer your question?
You could also attempt Sun Certified Enterprise Architect. It consists of an initial multi-choice exam, a project submission and a essay type exam based on the project.
Best way to know is to look at the java source file generated for a JSP that uses custom tags/beans. I found it at this location on my workstation

I have an example of SimpleTagSupport here.

Given a tag class simplemodel.HelloWorldTag extending SimpleTagSupport, the java source translated from jsp looked like this:

.. _jspService() ...
out.write("<B>Test 1</B>\r\n");
if (_jspx_meth_sm_helloWorld_0(_jspx_page_context))

with the method that actually invoked the tag looking like this:

1 private boolean _jspx_meth_sm_helloWorld_0(PageContext _jspx_page_context)
2 throws Throwable {
3 PageContext pageContext = _jspx_page_context;
4 JspWriter out = _jspx_page_context.getOut();
5 // sm:helloWorld
6 simplemodel.HelloWorldTag _jspx_th_sm_helloWorld_0 = new simplemodel.HelloWorldTag();
7 _jspx_th_sm_helloWorld_0.setJspContext(_jspx_page_context);
8 _jspx_th_sm_helloWorld_0.doTag();
9 return false;
10 }

Given what we know about the lifecycle, the container has to
a) create an instance of the tag - line 6
b) set the jsp context on the tag object line - line 7
c) call the setParent if it is nested and call the set attributes if they are used in the invocation - not applicable
d) invoke the doTag method of the tag's class - line 8

Please note that the actual source might vary depending on the vendor, this is just an example with tomcat 5.5

For java beans, the use bean tag is translated as below:

entity.Employee emp = null;
synchronized (_jspx_page_context) {
emp = (entity.Employee) _jspx_page_context.getAttribute("emp", PageContext.PAGE_SCOPE);
if (emp == null){
emp = new entity.Employee();
_jspx_page_context.setAttribute("emp", emp, PageContext.PAGE_SCOPE);

The jsp looked like this:
<jsp:useBean id="emp" class="entity.Employee" />

Does this answer your question?
Looks accurate to me.

The actual number of questions is 70 - one question is asked for statistical purposes. Test takers do not know which question this is, but you will not be scored on it.
Thanks guys, getting congratulations messages on javaranch is one of perks of being SCWCD !

Hi Friends,

I stumbled across the 90 mark with a score of 91% yesterday!

The first reading was accompanied by rigorous practice - one web app for each chapter. I also searched and read posts related to each topic on JavaRanch. This was very useful - bringing out subtle details that I had missed and highlighting aspects of importance to the exam.

I wrote my notes as documents on Google Docs and Spreadsheets allowing me to access and modify the matter without having to maintain copies that would need to be mailed between my work email id and personal email id. Never had to merge documents and never had to lose a interesting tip!

During the second reading, I studied my notes and consulted Mikalai Zaikin's SCWCD guide ( - updating my notes where necessary. I also made photocopies of a few summary pages in HFSJ - particularly the ones showing class hierarchies and life cycle events. Tried HFSJ mock and the whizlabs diagnostic mock(expensive!). Scored 75% on both.

On the day of the exam, I only read my notes. The exam did not begin well. The first few questions were alright, I was clueless on the next few. It affected my confidence. I did feel better an hour into the exam, thinking I might pass after all! I went back and made best choices on the tough ones, stretching logic and memory as much as I could.

If I had to do it again, I would:
1. allow more time for mocks - I think that could have added 2-3 percent points.
2. write notes for all chapters during the first reading, I missed some and that slowed the second reading.
3. spend more time on declarative security emphasizing the concepts more than the DD configuration.
4. reflect. extrapolate concepts/concerns of one topic to other topics - e.g. thread safety with filters.

A big thank you to G, the authors of HFSJ, fellow ranchers, Mark Peabody, Mikalai Zaikin and Google.

Thank you,
[ April 01, 2007: Message edited by: Anupama Ponnapalli ]
From the Spec (5.3)

The value of the name attribute in jsp:setProperty and jsp:getProperty will
refer to an object that is obtained from the pageContext object through its findAttribute