?
Solved

Undefined Variable??

Posted on 2003-03-23
3
Medium Priority
?
2,782 Views
Last Modified: 2008-02-01
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
Comment
Question by:jhazard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:jhazard
ID: 8190085
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
 
LVL 4

Accepted Solution

by:
thanassis earned 80 total points
ID: 8190124
You must put quotas on CountryID

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

Author Comment

by:jhazard
ID: 8190155
Brilliant!  Thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New style of hardware planning for Microsoft Exchange server.
If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question