View Single Post
  #2 (permalink)  
Old 07-04-2007, 04:01 PM
Marcus Marcus is offline
Member
 
Join Date: Jun 2007
Posts: 92
Marcus is on a distinguished road
I haven't tested this but I think it is something to do with using the "==" operator.

In other words, when you test a string for equality, you should either use "equals", or "equalsIgnoreCase".

When you use the "==" operator on Strings/Objects, you are basically checking if a given variable points to the same construct as another variable in memory.

so, you might need to change the following

Code:
if ( langChoice.equals("fr") && session.getValue("langPref").toString().equals( "eng" ) )
Also, I would strongly recommend that you use cookies instead of session variables.
Why you might ask? simply to store users preferences so you don't have to ask them a question they have already answered.
Plus, it will reduce the amount of request and response overhead on the server..so, it is a win win situation.

If you do decide to use cookies, make sure that you do a redirect...as the page that sets cookies won't be able to read it at the same time of writing it.

Greetings
Marcus
Reply With Quote