Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Why doesn't exercise 8-1 from Murach's Java Servlets work for me on IE7?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.
I am trying to run exercise 8-1 (Test URL Encoding) in Murach's Java Servlets and JSP (2nd Edition), and am running into trouble. The chapter comes with a "cart" NetBeans web application in which the user can add selected items to a cart and then the application shows the items in a table. The premise of the exercise is that if cookies are enabled in the browser, the URL's will be encoded with the session ID once, because the URLs are processed with the encodeURL() method in the JSP files. In fact that works - the first time I add something to the cart, the session ID is evident in the URL, but after I add subsequent items the session ID disappears because cookies are taking care of session ID tracking.

The exercise suggests that I disable cookies in the browser and try running it again. The expected result is that the session ID will continue to be encoded into the URL with every page, again because encodeURL is invoked. However, when I try this using IE7, I get the same result as when cookies are enabled. I feel pretty confident I did disable cookies, because when I try to log in to www.amazon.com, it gives me an error message because cookies are disabled. They obviously need the cookies for session tracking, etc.

I tried this exercise with Firefox, and got the expected results (session ID displayed in the URL once when cookies were enabled, and they were displayed for every page when cookies were disabled).

The exercise also suggests altering the JSP's so that the URL's are not encoded. That should work fine if cookies are enabled, but should result in a "cart" that only contains one item if cookies are disabled. With IE7, the cart worked (displayed all selected items) the same, whether I had cookies enabled or disabled.

I am including below the code from one of the JSP files. Obviously it won't be terribly meaningful without the classes that are imported or the web.xml file or the servlet code. However, if somebody out there wants to attempt to answer my question (which is, "why doesn't this exercise work with IE7?") and feels they need to see all this code, let me know and I'll post it.

Thanks!

cart.jsp:
 
rubbery bacon. crispy 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