• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Problem with Chapter 10 of Head First Servlets & JSP

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
John O'Donoghue
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic