[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2793
  • Last Modified:

Undefined Variable??

This is my error:

Error: 500
Location: /sell.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
/usr/local/tomcat3/work/www.desres.com_8080/_0002fsell_0002ejspsell_jsp_42.java:67: Undefined variable: CountryID
                CountryID=request.getParameter(CountryID);

This is my code:

<body>
<%
String CountryId="";
CountryID=request.getParameter(CountryID);
%>

What have I done wrong?
0
jhazard
Asked:
jhazard
  • 2
1 Solution
 
jhazardAuthor Commented:
Its ok spotted it- a simple typo!

However I'm now getting a null pointer expection

My code:
Javascript function
function changecountry(newcountry) {
    site = "sell.jsp?CountryID="+(newcountry);
    top.location.href=site;
}

<%
String CountryID="";
CountryID=request.getParameter(CountryID);
%>

<select name="cmbCountry" style="width: 172; height: 23" onchange="changecountry(this.options[this.selectedIndex].value)">
option value=England >England</option>
<option value=Scotland >Scotland</option>
<option value=Ireland >Ireland</option>
<option value=Wales >Wales</option>
</select>
0
 
thanassisCommented:
You must put quotas on CountryID

<%
String CountryID="";
CountryID=request.getParameter("CountryID");
%>
0
 
jhazardAuthor Commented:
Brilliant!  Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now