Luis Centeno

Ranch Hand
+ Follow
since Jul 31, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Luis Centeno

Hi Marlo...

Please take a look at HFSJ errata. There, you will find answers to any doubt you might have about correctness on HFSJ book.

Regards

Luis
Thank you all for your congrats...

Simran Dass wrote:
Congrats !!

Besides Whizlabs which other mock exams did you do (free or paid).Please tell.



I used most of the free exams mentioned in javaranch mock exams. I learned a lot from Niko's and Marcus Green's mock exams.

By the way, I read most of the notes created by some ranchers to help us. I strongly recommend the ones from Frits Walraven, PeabodyOnScwcdPatterns and Dale Seng's PowerPoint slides which I found specially useful...

I wish you the best...
Hi folks...

I am glad to announce that I have cleared SCWCD exam with 94% yesterday...After 4 months of hard study, I finally achieved this important goal and I am so happy!! Below I describe some things I performed during my preparation...

- I read Head First Servlet and JSP twice. While I read it second time, I created study notes from each chapter.
- I bought Whizlabs SCWCD 5. Although I got it before I finished reading HFSJ the second time, I did not take any mock exam (not even Diagnostic exam) from whizlabs until I finished reading second time. Once I thought I was prepared I took Whizlabs Diagnostic exam, 3 practice exams and Final exam. After taking each of those, I noticed my weak topics and I learned about them. I got scores 70-80% in whizlabs
- Last thing I did was taking HFSJ Final mock exam and got 64% (one day before the exam so I was so freaked out )

During my whole preparation and every time I had a doubt I posted a topic here and many of you guys helped a lot....and I did learn from others' question too...Thank you so much.

I would like to thank JavaRanch because this site is really great and all people who post here are always willing to patiently help us. I really appreciate it.

I would also like to thank (again) Kathy Sierra, Bert Bates and Bryan Basham for such a wonderful book. It is really helpful for certification and even if you are not going to get certified, it helps you to know many things that you didn't even think they exist.

For now, I am going to take some rest, because I ended up with a really bad headache yesterday but it is really worth...

Thanks again all of you...I hope I can contribute to JavaRanch as much as you do...

15 years ago
Hi Frits,


The value of the jsp:attribute has to be a String.


So this means that not always I use attributes in a custom tag, I can use <jsp:attribute>? I thought attributes and <jsp:attribute> was equivalent...Based on what you said, <jsp:attribute> must only be used when setItems(String) method exist in custom tag handler, right?


The following should work:
<rnd:showInTable items="${randomInts}"></rnd:showInTable>


I changed and it worked properly....

Thanks
Ankit,

You are absolutely right....it must have been include method from RequestDispatcher instead of forward. I changed it and it worked as expected, it brought the content of rndIntTable.jsp twice inside the html code...

Thanks
I am testing include standard action and import custom tag capabilities calling a servlet. For such purposes I created below servlet

..and a JSP (importTables.jsp) which calls it using <jsp:include> and <c:import>

TagServlet class is mapped to /randomTag url-pattern in web.xml. When I try to access the JSP, I get the content of rndIntTable.jsp only once and <html> and <body> tags from importTables.jsp are not shown. I thought that <jsp:include> (as RequestDispatcher.include) would return the control to importTables.jsp and show randomTag servlet response twice...Does servlet commit response to the client when service method ends regardles how it was called?
Hi all...

I am going through simple tag handlers. I created a tag handler whose items attribute accepts rtexprvalue:


...and using this tag as

I am getting "Syntax error on token "[", delete this token" and noticed that in generated class is below line:

I know that translation is container-specific but I am not sure if translation was correctly performed by my container (Tomcat 5.5.9), I mean casting to "[I" class does not seem to be correct since "[I" is not a valid identifier for a java class. Any ideas about this behavior?
OK, this seems to be a tricky part of JSPs. I will keep this on my mind for the exam...

Thanks Parth and Frits
Hi Frits...

Yes, you are right. I forgot to mention that I needed to add page directive with isErrorPage attribute set to true in order to get JSP implicit object exception. When I removed the page directive, it errored out as you say...

So, this means that exception object will always be available through pageContext implicit object in EL regardless page is or is not a designed error page?

Thanks
Hi Parth,

Thanks for your reply. I did exactly what you said and it did not work either. It did not work as exception is not an EL implicit object and it is not bound as an attribute in any scope (please correct me if I am wrong). I think you might referred to exception implicit object from scripting which I accessed with below code...



It showed the information as I expected...

Please let me know if I am missing something...

Regards
Hi folks...

I am going through JSP used as error pages. I created one example in order to verify exception implicit object behavior and I have one doubt...

I created a jsp...



and error page specificError.jsp


I got following output...

This is a specific error
Exception: javax.servlet.jsp.JspTagException: In URL tags, when the "context" attribute is specified, values of both "context" and "url" must start with "/".
Message: In URL tags, when the "context" attribute is specified, values of both "context" and "url" must start with "/".
StackTrace: [Ljava.lang.StackTraceElement;@c8570c

I know why the exception is thrown, but according to HFSJ, exception object should not be available when page directive does not include isErrorPage attribute, in this case exception is giving me information about the exception though...

Any idea will be appreciated...Thanks in advance
I just found myself the answer in JSP spec (2.3.7)


Empty Operator - empty A
• If A is null, return true,
• Otherwise, if A is the empty string, then return true.
• Otherwise, if A is an empty array, then return true.
• Otherwise, if A is an empty Map, return true,
• Otherwise, if A is an empty Collection, return true,
• Otherwise return false.



Thanks and I hope this topic helps others
I wrote below jsp code in order to test EL operator empty



and it returns

empty nonExistingAttr: true
empty string1: true
empty "": true
empty null: true

I am not sure how come ${empty string1} and ${empty ""} evaluate to true since string1 attribute exists and "" is not null.

Is empty operator intended to test empty strings as well as null values?


For the exam, trust your book better than your container.


Sure, I will...thanks a lot!
I read in HFSJ that types (other than primitives) referred in <function-signature> element in TLD files for EL functions must be written in a fully-qualified way...However, I created below TLD file and surprisingly it works...



I thought it would have thrown a translation error but it worked fine and returned String value. Is String the default value when a type referred in <function-signature> cannot be found?