File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes request.getOptionValueCount() problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getOptionValueCount() problem" Watch "request.getOptionValueCount() problem" New topic

request.getOptionValueCount() problem

Gary Damschen

Joined: Sep 06, 2001
Posts: 1
As I understand it, request.getOptionValueCount(paramName) can be used to determine whether or not a particular name-value pair has been passed to a jsp page. I am having a problem with the following piece of code that seems to work everywhere but on one particular page:
if (request.getOptionValueCount("amount") > 0)
// do something useful with request.amount
When I access the page I get the following error:
A problem occurred while processing this page. The error message is:
Javascript Error: ReferenceError: amount is not defined
lib/payment/cc_payment_info.js(Line 112)
Line 112 is the request.getOptionValue() line. I expected the server to skip the amount code section if there was no amount parameter passed into the page or amount= was passed in. Any suggestions re:what is causing the problem or how to work around it?
Manjunath Reddy
Ranch Hand

Joined: Jul 26, 2001
Posts: 60
i couldnt find the above method....but whats wrong with request.getParameter("Amount")?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

... Which will return null if the parameter value was not passed in from the client.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: request.getOptionValueCount() problem
It's not a secret anymore!