Vince Hon

Ranch Hand
+ Follow
since Feb 11, 2003
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 Vince Hon

Hi, I would like a jsp page under WEB-INF/jsp/test.jsp to be intercepted by the filter when FORWARD come to test.jsp, how can I do that ?

I have try this but failed:
additional info of my webapp:

I am now designing a logging system for my webapp which is based on Apache Struts framework.

To avoid using System.out.println() for logging, I use the J2SE java.util.logging tools.
My question is that: How to get the Logger for my webapp ? I have designed 3 cases:

case 1:
Getting a private static logger of each classes. As there are many StrutsAction classes, it seems the code is not tidy.

case 2:
Write a single Logger common to the package, and ALL classes within the webapp will use this logger for logging.

case 3:
Same as case 2, except I initialize a Logger during the SerletContext Initialization and put this as ServletContext attribute, then all StrutsAction class get the logger from Servlet Context during runtime.

Thus, prevent from using a static logger which is hardcoded in the StrutsAction class. However, I doubt if any significant overhead is added in the system.

Could any expert share your experience about this ?

IllegalStateException thrown when you commit the response (<%= out.flush() %> before using forward, include or redirect,e.g. <jsp:include page="">.
18 years ago
I got it, just put the XXX.jar under the /lib directory in the myejb.jar
In webapp WAR file, dependency library can be put into /WEB-INF/lib/XXX.jar.

I just wonder where should I put the XXX.jar in myejb.jar ?
(myejb.jar needs a dependency library to deploy)

javax.naming.InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(dbname);
con = ds.getConnection();

That's it. It seems it is very dummy code.

You should use the J2EE Service Locator Pattern, to write a class that encapsulate JNDI calling,
check at -->
18 years ago
Download and install Tomcat 5.0 (using J2SE 1.4, JSP2.0 and Servlet 2.4) at
Config it well, check / study the examples inside tomcat.

This is good for starting(note: HFB contains examples using Tomcat 5.0).
I cleared the SCWCD with 89% last week !

Thanks for the authors of HFSJ and all members of JavaRanch !

I would like to share my learning path with all of us.

After graduation, I passed the SCJP. Now, I am an Analyst Programmer to develope internal web-based systems.

I have 2 years experience of webapp development as well as the Business Tier using J2EE, mainly built on the Servlet, Jsp and Apache Struts framework. After getting the SCBCD, I found it will be valuable either for my career or self-improvement, so I planned to get the SCWCD.

Study Duration:
- 2 months

Study Materials:
- HSFJ + JSP and Servlet Spec
- Using Tomcat to test, EL, jsp and standard actions
- Checking thread on JavaRanch

Based on my experience of webapp development, studying HSFJ is not a hard job. However, since I used Struts for development, I used extensively the Struts tag library. The topic like:
1. EL
2. Standard Action (e.g. <c:if> ..)

is quite harsh for me. I need to spend lots of time to learn the syntax of the standard tag, esp the <c: XXX>.

On the other hand, I found the Design Pattern very easy, as I have already applied them in my applications. To be honest, studying the J2EE patterns from the is not a easy job for a beginner. I really appreciated the way that HSFJ used to introduce the J2EE patterns.

I think studying the SCWCD is very good both for beginner and experienced webapp developer. After reading HSFJ, I started to used Filters to handle
authentication checking and authorization (previously, I put those code on a Generic Struts Action class). I used EL to make the JSP tidy. Use the SimpleTag in webapp development...

- Study the HSFB intensively, do all the mock.
- There must be place that you won't understanding during your reading, in most case, you can clear them from the /* JSP/Servlet Spec and JavaRanch */ !
- Keep checking the errata of HSFJ, this saves you lot of time.
- Using Tomcat to testing.
- PS: my final mock exams on HFSJ is 70%.

Good luck !
Enjoy your studying !
I have a query (SELECT * FROM ABC WHERE ID IN (?)) and I want to pass in parameter a list of values (an array or something like that) to put in my condition IN.

So that the result sql is:

I don't want to use the following methods:

If I DON'T use session tracking (no cookie and no URL rewriting) and SSL.

All of these 3 auth-methods:

can be used BUT the website just continuously show up the login page (for FORM method) or popup window to request login (for BASIC and DIGEST) even the username and password are correct, right ?
For HFB, Mock Exam p.823

The answer is:

I just wonder the correct answer should be

Am I correct ?
Thanks Sawan, I finally got the solution:

When the request for / will come it will be intercepted by NormalAccessFilter. As this filter is not calling others in chain here you can dispatch the request to any resource that you want. That means in normal access filter you can dispatch to / and it will work

My understanding:

Treat NormalAccessFilter as a filter that /* stop any follow filter chain and dispatch to the request resource directly */.