It's not a secret anymore!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ problem-Dynamic attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ problem-Dynamic attribute" Watch "HFSJ problem-Dynamic attribute" New topic

HFSJ problem-Dynamic attribute

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 331

I am refering the HFSJ 1.5 book page number 542.

Earlier it was,

<select name='color' size='1'>
<option value='light'> light </option>
<option value='amber'> amber </option>
<option value='brown'> brown </option>
<option value='dark'> dark </option>

But then they have replace the above index.jsp with the following custom tag with use of dynamic attirbute to create the above select tag,

<formTags:select name='color' size='1' optionList='${applicationScope.colorList}' />

I think colorList is the List which store above light,amber,brown,dark values. But it newer decalre any where. Later in page 557 they have given the tag handler class but its not declare there and even we cant declare it there also know since its a java class it gives error when you just declare a list outside a method and add values to it. I think its also not possible to declare it in the Servlet which handle the form submit becuse its too late. So where should it be declared?

Any one reading the book this part noticed it?

Thank You.

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 331
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

You'll find the same tutorial here, from the author of the book. The author says that the attribute is set in the servlet (although it uses sessionScope instead of applicationScope). You can try to put it in the application scope instead.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: HFSJ problem-Dynamic attribute
It's not a secret anymore!