"get" variable not populated

Happy Labor Day! removecookie is not being populated with value stored in <%= cookies[i].getName() %>. While investigating I added code to verify <%= cookies[i].getName() %> did indeed have a value, which it does. There are other jsp's associated with this application. This example is from the book JavaServer Pages by Xue Bai.

This statement is the one not putting the array element value in the "get" variable. Any suggestions? I can post the other two jsp in this example, I don't believe the problem lies there. Before you gripe about the table tag, that's how the text book's example is coded. I believe the point of the book is to teach jsp concepts and not css.

I'd have a closer look at your quotes on that line. I don't think you're closing them in the right place - the cookie name wouldn't be part of the URL.

I'd suggest having a look at the generated HTML source to confirm it.

Ivan Turner
Ranch Hand

Joined: Feb 27, 2012
Posts: 37

posted Sep 03, 2012 11:43:09

0

NetBeans was giving this error/warning on this <a href="example7-3.jsp?removecookie=<%= cookies[i].getName() %>">Remove?</a> Bad value "example7-3.jsp?removecookie= " for attribute "href" on element "a": DOUBLE_WHITESPACE in QUERY.
Syntax of IRI reference:
Any URL. For example: '/hello', '#canvas', or 'http://example.org/'. Characters should be represented in NFC and spaces should be escaped as '%20'.

From line 20, column 19; to line 20, column 63
(Rule Category: Attributes)
----
I moved the quotation mark to remove the warning <a href="example7-3.jsp?removecookie="<%= cookies[i].getName() %>>Remove?</a> When I put the quotation back to the warning location, the file works as described in the book even though the warning returned in the IDE. All's well that ends well!!!