Name: Anonymous 2008-04-06 12:46
I'm having some problems with servlets.
i'm writing a cookie that contains a car model and a vector containg html links to all other car models made by that manufacturer.
A lot of these models have a manufacturer in common, so i'm using if statements to determine the manufacturer. Everything reads in okay, but i cant get it to actually initialise the right manufactuer name to my 'make' variable.
Here's what i'm doing in my doGet:
Cookie cookies[] = request.getCookies(); // get cookies
String modelList = new String(cookies[ 0 ].getName()); //vector
String model = new String(cookies[ 0 ].getValue()); //the model
String make = ""; //the make(manufacturer)
String[] arr = {"Ford","Toyota","Citroen","Mazda"};
if((model.equalsIgnoreCase("Fiesta")) || (model.equalsIgnoreCase("Focus")) || (model.equalsIgnoreCase("Mondeo")) || (model.equalsIgnoreCase("Mustang")))
{
make += arr[0];
}
if((model.equalsIgnoreCase("Celica")) || (model.equalsIgnoreCase("Auris")) || (model.equalsIgnoreCase("Yaris")) || (model.equalsIgnoreCase("Prius")))
{
make += arr[1];
}
if((model.equalsIgnoreCase("C2")) || (model.equalsIgnoreCase("C3")) ||
(model.equalsIgnoreCase("C4")) || (model.equalsIgnoreCase("C5")))
{
make += arr[2];
}
else{
make += arr[3];
}
unfortunetly, it always results in the use of my else case...
If print out model, it shows up fine!
Can the might of /prog/ show me where i'm fucking up?
i'm writing a cookie that contains a car model and a vector containg html links to all other car models made by that manufacturer.
A lot of these models have a manufacturer in common, so i'm using if statements to determine the manufacturer. Everything reads in okay, but i cant get it to actually initialise the right manufactuer name to my 'make' variable.
Here's what i'm doing in my doGet:
Cookie cookies[] = request.getCookies(); // get cookies
String modelList = new String(cookies[ 0 ].getName()); //vector
String model = new String(cookies[ 0 ].getValue()); //the model
String make = ""; //the make(manufacturer)
String[] arr = {"Ford","Toyota","Citroen","Mazda"};
if((model.equalsIgnoreCase("Fiesta")) || (model.equalsIgnoreCase("Focus")) || (model.equalsIgnoreCase("Mondeo")) || (model.equalsIgnoreCase("Mustang")))
{
make += arr[0];
}
if((model.equalsIgnoreCase("Celica")) || (model.equalsIgnoreCase("Auris")) || (model.equalsIgnoreCase("Yaris")) || (model.equalsIgnoreCase("Prius")))
{
make += arr[1];
}
if((model.equalsIgnoreCase("C2")) || (model.equalsIgnoreCase("C3")) ||
(model.equalsIgnoreCase("C4")) || (model.equalsIgnoreCase("C5")))
{
make += arr[2];
}
else{
make += arr[3];
}
unfortunetly, it always results in the use of my else case...
If print out model, it shows up fine!
Can the might of /prog/ show me where i'm fucking up?