Internationalization problem

2001-01-08 Thread Raphaël Lemaitre

Hi,

I got a problem with i18n. I want to use a french localized
GregorianCalendar but when i execute my JSP, the GregorianCalendar is not
French Localized. I use jakarta-tomcat 3.2 with Sun JDK 1.3; On the other
hand, when i execute the same code in a java application (with sun JVM 1.3),
the result is exactly wath i expect. What am i missing in jakarta
configuration?

Here are the source code and the result of my JSP and the java app

testCalendar.jsp:
*

%@page session="true" import="java.text.*, java.util.*"%
html
head
/head
BODY TEXT="00" BGCOLOR="EBF2F1" LINK="501123" ALINK="501123"
VLINK="501123"
%
Vector days = new Vector();
Vector weeks = new Vector();
java.text.SimpleDateFormat sdf = new SimpleDateFormat("",
Locale.FRANCE);
java.text.SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/",
Locale.FRANCE);
GregorianCalendar myCalendar = new GregorianCalendar(Locale.FRANCE);
myCalendar.setTime(sdf2.parse("05/01/2001"));
myCalendar.set(myCalendar.DAY_OF_WEEK,
myCalendar.getFirstDayOfWeek());
for (int i = 0; i  4; i++) {
weeks.addElement(new
Integer(myCalendar.get(myCalendar.WEEK_OF_YEAR)));
for (int j = 0; j  7; j++) {
days.addElement(myCalendar.getTime());
myCalendar.setTime(new
Date(myCalendar.getTime().getTime() + (1000*60*60*24)));
}
}
%
table
tr
td/td
%
for (int j = 0; j  7; j++) {
%
td
%=sdf.format((Date) days.elementAt(j))%
/td
%}%
/tr
%for (int i = 0; i  4; i++) {%
tr
td
%=weeks.elementAt(i)%
/td
%for (int j = 0; j  7; j++) {%
td
%=sdf2.format((Date) days.elementAt(7 * i + j))%
/td
%}%
/tr
%}%
/table
/body
/html

the result is :
Sunday  Monday  Tuesday Wednesday   ThursdayFriday
Saturday 
1   31/12/2000  01/01/2001  02/01/2001  03/01/2001
04/01/2001  05/01/2001  06/01/2001 
2   07/01/2001  08/01/2001  09/01/2001  10/01/2001
11/01/2001  12/01/2001  13/01/2001 
3   14/01/2001  15/01/2001  16/01/2001  17/01/2001
18/01/2001  19/01/2001  20/01/2001 
4   21/01/2001  22/01/2001  23/01/2001  24/01/2001
25/01/2001  26/01/2001  27/01/2001 

testCalendar.java
*
import java.text.*;
import java.util.*;

public class TestCalendar {
public static void main(java.lang.String[] args) {
Vector days = new Vector();
Vector weeks = new Vector();
SimpleDateFormat sdf = new SimpleDateFormat("",
Locale.FRANCE);
SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/",
Locale.FRANCE);
GregorianCalendar myCalendar = new
GregorianCalendar(Locale.FRANCE);
myCalendar.setTime(sdf2.parse("05/01/2001"));
myCalendar.set(myCalendar.DAY_OF_WEEK,
myCalendar.getFirstDayOfWeek());
for (int i = 0; i  4; i++) {
weeks.addElement(new
Integer(myCalendar.get(myCalendar.WEEK_OF_YEAR)));
for (int j = 0; j  7; j++) {
days.addElement(myCalendar.getTime());
myCalendar.setTime(new
Date(myCalendar.getTime().getTime() + (1000*60*60*24)));
}
}
System.out.print("\t");
for (int j = 0; j  7; j++) {
System.out.print(sdf.format((Date)
days.elementAt(j)) + "\t");
}
System.out.println();
for (int i = 0; i  4; i++) {
System.out.print(weeks.elementAt(i) + "\t");
for (int j = 0; j  7; j++) {
System.out.print(sdf2.format((Date)
days.elementAt(7 * i + j)) + "\t");
}
System.out.println();
}
}
}

and the result is :

lundi   mardi   mercredijeudi
vendredisamedi  dimanche
1   01/01/2001  02/01/2001  03/01/2001  04/01/2001
05/01/2001  06/01/2001  07/01/2001  
2   08/01/2001  09/01/2001  10/01/2001  11/01/2001
12/01/2001  13/01/2001  14/01/2001  
3   15/01/2001  16/01/2001  17/01/2001  18/01/2001
19/01/2001  20/01/2001  21/01/2001  
4   22/01/2001  23/01/2001  24/01/2001  25/01/2001
26/01/2001  27/01/2001  28/01/2001  

--
Raphal LEMAITRE 
mailto:[EMAIL PROTECTED] 
e-deal 
86-88 rue du Vieux 

RE: How can i share session between servlet and jsp

2000-12-12 Thread Raphaël Lemaitre

 Raphaël Lemaitre typed the following on 11:56 12/12/2000 +
 But when i want to follow a hyperlink that points to a
 servlet, i do not get the same session (session Ids are different). 
 
 How are you building this hyperlink exactly? Is it a relative link?
 What exactly does the URL to the JSP page look like vs. the
 URL to the servlet? Are the hostnames exactly the same? If
 not you could be losing the session ID cookie. Are you sure your
 browser is taking the cookie? 
 
 Kief
 
Thanks, the problem is solved. In fact, i mispelled my webapp name in the
URL.

Raphael Lemaitre