Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Chapter 10 of Head First Servlets & JSP

 
John O'Donoghue
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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.


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic