Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!

Phoebe Jones

Greenhorn
+ Follow
since Dec 15, 2004
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 Phoebe Jones

92% - HFS mock 65% !!!

I have been preparing for this exam off and on for 1 � year � decided to go for 1.4 and waited for HFS (for a looong time!). Worked full time as a web developer � J2EE and Microsoft stuff � so I have experience.

Preparation:
1. Read HFS 2 times � over long period. (Not a good idea.) Read it once again 2 weeks prior to test � memorizing and augmenting the book with the JSP and Servlets specs. (I only read the specs when I needed more details � such as the jsp-config section, dynamic attributes, and various elements concerning JNDI lookups�) I also referred to the Servlet and JSP APIs frequently.
2. Then last weekend I went over the whole book again, starting with doing the exercise at the end of the chapter to see how well I remember the material, and then went over the materials I missed.
3. Went over the important APIs � ServletReqeust, ServletResponse, ServletConfig, ServletContext. The DD � the servlet spec has a nice section of the DD diagrams. I found it very helpful memorizing the elements by looking at the pictures!
4. Did the Mock mid-Sunday morning � didn�t panic (well, a little concerned) � went over my mistakes. Retook it the next day. Only missed one and got it done in an hour. I thought it was an excellent idea to retake the mock as it really prepared me for the style of the real exam. And yes, the degree of difficulty is very similar.
5. On the day of the exam, I went over my notes � mostly on tricky things such as DD elements, listeners and the APIs.
6. I mark questions with exhibit and task (drag & drop) without answering them the first go around. It took me a little over an hour to finish the whole exam. I was able to go back and check my answers 2 times. No problem with drag and drop. Note: if you review your drag and drop, you�d have to re-do it. So look at it really closely the first time!
7. Pay attention on how to access attributes using EL. If you can do the questions in HFS, you will have no problem.
8. I have a lot (5 or 6) of pattern questions. But they are not difficult.
9. I did not take any other mock exams. Didn�t use anybody�s notes.
10. I did write a lot of little tests using Tomcat to cement the concepts. I studied Tomcat�s JSP 2.0 examples. They�re very helpful.
11. Last but not least, study the HFS thoroughly, and if you see anything in the practice test that wasn�t mentioned in the chapter � explore it! Because there were stuff on the exam that wasn�t covered (but are in the practice test).

Good luck! I had fun preparing for this one. Now it is onto SCBCD! (I already got HF EJB - my Valentine Day present!)
To see how much simpler it is to user Simple Tag -

package myTagHandler;
import javax.servlet.jsp.JspException;
import java.io.IOException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.util.ArrayList;

public class MenuSimple extends SimpleTagSupport {
private ArrayList items = new ArrayList();
public void addMenuItem ( String item) {
items.add ( item );
}

public void doTag() throws JspException, IOException {
getJspBody().invoke(null);
getJspContext().getOut().println (" Menu items are: " + items + "<br>" );
}
}

package myTagHandler;
import javax.servlet.jsp.JspException;
import java.io.IOException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class MenuItemSimple extends SimpleTagSupport {
private String itemValue;

public void setItemValue (String value) {
itemValue = value;
}

public void doTag() throws JspException, IOException {
MenuSimple parent = (MenuSimple) getParent();
if ( parent != null ) {
parent.addMenuItem (itemValue); // Call parent's method
}
}
}




--- to test it ---

<%@ taglib prefix="mine" uri="MyTagLibrary" %>
<html><body>

<h3>TestMenuSimple.jsp</h3>

<mine:MenuSimple>
<mine:MenuItemSimple itemValue="Dogs" />
<mine:MenuItemSimple itemValue="Cats" />
<mine:MenuItemSimple itemValue="Horses" />
</mine:MenuSimple>

</body></html>
Thanks. Good to know that there might not be other ways than to write an EL function or a custom tag.

I tried it with an EL function . It works quite nicely.
The function signature is java.util.Map jspInitParams( javax.servlet.ServletConfig )

and I call it with, eg. ${ myFunc:jspInitParams( pageContext.servletConfig) }

or
${ myFunc:jspInitParams( pageContext.servletConfig)["initParamName"] }
Nitish,

If you read pg. 308, you'd see what I am asking about. I can get the init params, but I am trying to do it without the scriptless way, i.e. using EL.

Thanks for your reply!
On page 208 of the book, we have an example of of setting up init param for JSP, and scriptlet code to get to it.

There is no EL implicit object for servlet/Jsp init params ( there is one for servletContext/applicatin init parameters. I know I can use the pageContext implite object to get to the servletConig object, eg.

${pageContext.servletConfig.servletName}

But I can't get to the initParameters . Please advise.

Thanks!