File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HeadFirst Servlets and Jsp pg 548 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HeadFirst Servlets and Jsp pg 548" Watch "HeadFirst Servlets and Jsp pg 548" New topic

HeadFirst Servlets and Jsp pg 548

Neil Muya
Ranch Hand

Joined: Oct 26, 2009
Posts: 30
Hi ranchers,

Just confused at HeadFirst Servlets and Jsp pg 548 .

Here is a part of a code in the jsp:

Here is the part where the attribute optionList was declared

The note that was from HFSJ : "The optionList attribute needs to specify the datatype."

Implicitly if you don't declare the <type></type> element the default would be type of String.

So then I tried to do this hoping this would produce an error

But it went out that the code was successful without errors.

Just confused , what's the use of declaring type element?

or maybe the question is, what happens when I declare type?

Thanks in Advance!
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

mmhh... The type seems to be ignored completely. I tried set an attribute of type Exception, but set the "type" to "java.util.List" in the TLD. No errors. It supposed to default to java.lang.String...

[My Blog]
All roads lead to JavaRanch
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2102

Hi Neil,

That is strange, what did it output on your page? Did you restart the server (and hit F5 a couple of times)?

To show you an example that works fine with the type element look at this thread:Enum and Tags

I agree. Here's the link:
subject: HeadFirst Servlets and Jsp pg 548
It's not a secret anymore!