• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"get" variable not populated

 
Ivan Turner
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


Thank you.
 
Ivan Turner
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<td><a href="ch7example7-3.jsp?removecookie="<%= cookies[i].getName() %>>Remove?</a>

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.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic