aspose file tools*
The moose likes JSP and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark ""get" variable not populated" Watch ""get" variable not populated" New topic
Author

"get" variable not populated

Ivan Turner
Ranch Hand

Joined: Feb 27, 2012
Posts: 37
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

Joined: Feb 27, 2012
Posts: 37
<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

Joined: Apr 06, 2010
Posts: 4392
    
    8

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
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!!!
 
Consider Paul's rocket mass heater.
 
subject: "get" variable not populated