Rufus Addis

Ranch Hand
+ Follow
since Aug 21, 2008
Merit badge: grant badges
For More
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 Rufus Addis

I'm guessing that the OP is using a custom tag library in a JSP page.

In which case from memory (which is a little rusty) the web application server will look for the defined tag and replace it with the output from the custom tag library.

Therefore to answer the OP's original question, no escaping is required assuming the output from the custom tag library is valid as an href attribute.

i.e.



The application server will replace the bit between the <tttt: and /> with the output from the tag library giving you:



Rufus.
Hi Deva,

I think a major part of the problem is that the browser is using Quirks mode which at best has unpredictable results. It's worth getting in to the habit of making sure any HTML you write has a doctype specified. At its simplest replace the <html> with:



Testing your latest sample html (with id's specified) and adding a doctype, it works for me in IE8, Chrome.

If you are still having problems can reply with details of which browser you are testing in.

Thanks - Rufus.
In the 2nd Edition pg397 they have $(requestScope["integer"] ne ......

Errata for 1st Edition:

http://oreilly.com/catalog/9780596005405/errata/

Under cofirmed errors:

(393) 3rd item of "What prints for each of these?";
${requestScope[integer] ne 4 and 6 le num || false}
should read:
${requestScope["integer"] ne 4 and 6 le num || false}


Rufus.
I haven't tested your code, but I can't see a:



in your outer tag. This is needed to tell the container it should evaluate the content enclosed by the tag (invoking any children tag handlers in the process).

On a side note I'd recommend reviewing your naming as I found it a little confusing having a class called "JS_Classic_Outer" that uses the SimpleTagHandler interface!

Rufus.
If you are getting an Error 500, then the server has encountered an "internal" error.

The easiest way to identify the cause is to find the server log file, and look at what exception was thrown!

Assuming you are using TomCat on a local machine then by default the exception will be written to localhost.yyyy-mm-dd.log in your logs sub-directory. Where yyyy-mm-dd is the current date, and the logs sub-directory is usually under the parent tomcat install directory.

For neatness it is sometimes best to stop tomcat, delete ALL the log files, start tomcat then open the URL that is causing the error.

If you need any help diagnosing the error then post the exception details from the log file.

Rufus.
Sudheer, sorry to here about your near miss, and you should be comended for having the bravery to share your experience. It makes a refreshing changed to all the "I got 115%" type posts

Do you have an idea why you ran out of time, as I usually find Sun quite generous with their exam times. However I guess that depends a lot on what questions they throw at you, and whether the exam is in your native language.

Good luck in retaking, and with two weeks to go it may be worth investing in an exam simulator (Enthuware or Whizlabs) to practice pacing yourself to ensure you have enough time for each question.

Rufus.
15 years ago
Sadly so Deepak! But to be fair I think there are errors in most technical books!

Rufus.
Better than an Eratta, a post by the exam author:

https://coderanch.com/t/171415/java-Web-Component-SCWCD/certification/final-Mock-HFSJ#000004

Essentially what you post is entirely correct, but not in the "spirit" of the question.

Rufus.
Good observations and I concur!

I definitely agree with HFSJ being "too heavy" after a couple of weeks studying I had quite bad RSI type pains from holding the book, and having a thick spine you couldn't rest it on a table without damaging it.

Reading it on the train was nigh impossible!

If only they made a PDF version of it that you could buy / download if you owned the book!

Rufus.
Both mocks I think are good. However for me the Enthuware was half the price. Support from them was good, and the quality of questions was good.

I haven't used he Whizlabs version but would have no hesitation in recommending the Enthuware if you are willing to accept it's not perfect.

Worth noting that the Enthuware simulator for dragging and dropping answers is "better" than the real exam i.e. in Enthuware it remembers the answers when you review, in the real exam it clears them out so you can't check what you've put once you close the window!

Rufus.
From the specs:

setMaxInactiveInterval()
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.

So a zero value will cause the container to immediately expunge the session!

Rufus.
You will be better off asking this question in a more appropriate forum. If the question is specifically about Tomcat then the Apache Tomcat forum should help:

https://coderanch.com/forums/f-56/Tomcat

As with lots of these things, the number of processes, and threads supported is configurable, and each implementation will have it's own foibles over when new processes are created.

There is a subtle distinction between threads from the httpd perspective (i.e. to handle requests for anything including images / static html), and threads allocated to servlets.

If the number of threads a process is alloated becomes too large then processes spend too much time (and memory) handling threads rather than dealing with the task in hand. Whether that is for a httpd process, or a process that the servlet container runs in.

Rufus.
Firstly the Single Thread Model is deprecated in the Servlet API spec 2.4 and as far as I know no longer an objective in the latest SCWCD exam.

In answer to your question I believe that there is nothing in the specs which specify whether the servlets are created concurrently or not, it's up to the container implementation. The container has to ensure that no two threads share the same instance of the servlet. It is not uncommon to create a number (pool) of servlet instances [concurrently], then make instances of the serlet available from that pool to threads under the STM.

However I would urge you purge the Single Thread Model from your brain as it has no place in a Java developers mind!

Rufus.
My understanding is that there will always be a seperate occurance of the Classic Tag handler per thread.

So for example if two threads invoke the classic tag, then there will be two instances of the classic tag handler available, and the member variables will affectively be thread safe.

However these instances of the classic tag handler may be either be new created instances, or re-use existing instances (that are no longer being used). Obviously re-used tags handlers will have member variables in an indetermant state.

Simple tags always get new instances!

Rufus.
Worth checking the Errata, there were in my opinion an unacceptably large number of errors in the mock exam for the 2nd edition - corrected in later prints:

http://oreilly.com/catalog/9780596516680/errata/9780596516680.0708

This I found demoralising when sitting the mock, but Question 6 is in the errata!

Rufus.