This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Problem with Chapter 10 of Head First Servlets & JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with Chapter 10 of Head First Servlets & JSP" Watch "Problem with Chapter 10 of Head First Servlets & JSP" New topic
Author

Problem with Chapter 10 of Head First Servlets & JSP

John O'Donoghue
Greenhorn

Joined: Jan 09, 2013
Posts: 2
Hi all

I have been trying for a week to solve a strange problem in the BeerSelect problem in Chapter 10 of Head First's Servlets & JSP Book.

I can get the code to run perfectly except that when I call the initial jsp page up in the browser, only Amber, Brown and Dark appear as options. I can't get Light to appear. If I select either amber, brown or dark I always get the right options back in results.jsp so I think everything after the initial BeerSelect.jsp pages must be working correctly.

When I put in various setAttributes and getAttributes I can see that all four beer types are there in the Container and I can get the full list of options to appear on the results.jsp page by calling getAttribute on the optionsList attribute in the code below. Also if I put an empty option in before "Light" in the BeerExpert.java file, all four options appear.

However the initial html selection field (from BeerSelect.jsp) won't show "light" which is the first of the 4 options.

Has anyone else come across this.


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60756
    
  65

Welcome to the Ranch.

I assume <mine:select> is a custom tag you have written? We'd need to see the code.

Have you checked that the list received by the tag code is complete?

Have you looked at the HTML being sent to the browser to see if it is well-formed?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John O'Donoghue
Greenhorn

Joined: Jan 09, 2013
Posts: 2
It never dawned on me to look at the html generated. The problem was obvious in seconds. I had left a out.println(">"); out of the code.

Thanks for the suggestion.

John
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60756
    
  65

 
 
subject: Problem with Chapter 10 of Head First Servlets & JSP
 
Similar Threads
Java Simple Tag Handler
Servlet Doesn't appear to be working.
strange error with respect to web.xml file
unable to access the attribute in any of the container scope
Doubt in JSP Custom tags (Simple Tag) in Dynamic Drop Down